Skip to content

Commit a405b28

Browse files
committed
Delete heredoc line mark references
1 parent 5fc9810 commit a405b28

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

node.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ rb_node_buffer_new(void)
9393
#define Qtrue ast->node_buffer->config->qtrue
9494
#define NIL_P ast->node_buffer->config->nil_p
9595
#define rb_hash_aset ast->node_buffer->config->hash_aset
96+
#define rb_hash_delete ast->node_buffer->config->hash_delete
9697
#define RB_OBJ_WRITE(old, slot, young) ast->node_buffer->config->obj_write((VALUE)(old), (VALUE *)(slot), (VALUE)(young))
9798
#endif
9899

@@ -458,6 +459,13 @@ rb_ast_add_mark_object(rb_ast_t *ast, VALUE obj)
458459
rb_hash_aset(ast->node_buffer->mark_hash, obj, Qtrue);
459460
}
460461

462+
void
463+
rb_ast_delete_mark_object(rb_ast_t *ast, VALUE obj)
464+
{
465+
if (NIL_P(ast->node_buffer->mark_hash)) return;
466+
rb_hash_delete(ast->node_buffer->mark_hash, obj);
467+
}
468+
461469
VALUE
462470
rb_ast_tokens(rb_ast_t *ast)
463471
{

node.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ void rb_ast_mark(rb_ast_t*);
6767
void rb_ast_update_references(rb_ast_t*);
6868
void rb_ast_free(rb_ast_t*);
6969
void rb_ast_add_mark_object(rb_ast_t*, VALUE);
70+
void rb_ast_delete_mark_object(rb_ast_t*, VALUE);
7071
void rb_ast_set_tokens(rb_ast_t*, VALUE);
7172
NODE *rb_ast_newnode(rb_ast_t*, enum node_type type, size_t size, size_t alignment);
7273
void rb_ast_delete_node(rb_ast_t*, NODE *n);

parse.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8756,6 +8756,7 @@ heredoc_restore(struct parser_params *p, rb_strterm_heredoc_t *here)
87568756
if (p->eofp) p->lex.nextline = Qnil;
87578757
p->eofp = 0;
87588758
xfree(term);
8759+
rb_ast_delete_mark_object(p->ast, line);
87598760
}
87608761

87618762
static int

ruby_parser.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ rb_parser_config_initialize(rb_parser_config_t *config)
618618
config->hash_new = rb_hash_new;
619619
config->hash_aset = rb_hash_aset;
620620
config->hash_lookup = rb_hash_lookup;
621+
config->hash_delete = rb_hash_delete;
621622
config->ident_hash_new = rb_ident_hash_new;
622623

623624
config->int2fix = int2fix;

rubyparser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,7 @@ typedef struct rb_parser_config_struct {
12301230
VALUE (*hash_clear)(VALUE hash);
12311231
VALUE (*hash_new)(void);
12321232
VALUE (*hash_aset)(VALUE hash, VALUE key, VALUE val);
1233+
VALUE (*hash_delete)(VALUE hash, VALUE key);
12331234
VALUE (*hash_lookup)(VALUE hash, VALUE key);
12341235
VALUE (*ident_hash_new)(void);
12351236

0 commit comments

Comments
 (0)