diff options
author | yui-knk <[email protected]> | 2024-07-18 13:47:13 +0900 |
---|---|---|
committer | Yuichiro Kaneko <[email protected]> | 2024-07-20 11:25:26 +0900 |
commit | 6be539aab5b8fd66685e6079afc6ca83c89fcbd6 () | |
tree | fc3164f28dbb1f2a4ee752626521648937f15289 /node.c | |
parent | 174c01b80e31236ca144dc510a662cd18b9a20ee (diff) |
Change UNDEF Node structure
Change UNDEF Node to hold their items to keep the original grammar structure. For example: ``` undef a, b ``` Before: ``` @ NODE_BLOCK (id: 4, line: 1, location: (1,6)-(1,10))* +- nd_head (1): | @ NODE_UNDEF (id: 1, line: 1, location: (1,6)-(1,7)) | +- nd_undef: | @ NODE_SYM (id: 0, line: 1, location: (1,6)-(1,7)) | +- string: :a +- nd_head (2): @ NODE_UNDEF (id: 3, line: 1, location: (1,9)-(1,10)) +- nd_undef: @ NODE_SYM (id: 2, line: 1, location: (1,9)-(1,10)) +- string: :b ``` After: ``` @ NODE_UNDEF (id: 1, line: 1, location: (1,6)-(1,10))* +- nd_undefs: +- length: 2 +- element (0): | @ NODE_SYM (id: 0, line: 1, location: (1,6)-(1,7)) | +- string: :a +- element (1): @ NODE_SYM (id: 2, line: 1, location: (1,9)-(1,10)) +- string: :b ```
Notes: Merged: https://.com/ruby/ruby/pull/11213
-rw-r--r-- | node.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -163,6 +163,14 @@ parser_tokens_free(rb_ast_t *ast, rb_parser_ary_t *tokens) } static void free_ast_value(rb_ast_t *ast, void *ctx, NODE *node) { switch (nd_type(node)) { @@ -206,6 +214,9 @@ free_ast_value(rb_ast_t *ast, void *ctx, NODE *node) case NODE_IMAGINARY: xfree(RNODE_IMAGINARY(node)->val); break; default: break; } |