mruby-compiler: remove NODE_VARIABLE wrapper and modernize AST handling

This removes the NODE_VARIABLE enum and associated wrapper system, updating
the parser and codegen to work directly with variable-sized AST nodes.

Key changes:
- Removed NODE_VARIABLE from node.h enum
- Updated parser functions to handle direct variable-sized nodes
- Fixed codegen() main dispatch to detect variable-sized nodes directly
- Added helper functions for node type detection and header access
- Updated all parser and codegen functions to work with modern AST structure

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-09-25 09:34:09 +09:00
parent 9a1a0dac54
commit 6a3e26cf7a
4 changed files with 1855 additions and 1979 deletions
File diff suppressed because it is too large Load Diff
-5
View File
@@ -85,7 +85,6 @@ enum node_type {
NODE_HEREDOC,
NODE_WORDS,
NODE_SYMBOLS,
NODE_VARIABLE,
NODE_LAST
};
@@ -359,10 +358,6 @@ struct mrb_ast_super_node {
#define node_to_type(x) ((enum node_type)(intptr_t)(x))
#define node_to_char(x) ((char)(intptr_t)(x))
// Macros for variable-sized nodes
#define NODE_TYPE(n) ((enum node_type)(intptr_t)((n)->car))
#define NODE_VAR_NODE_PTR(n) ((struct mrb_ast_var_header*)((n)->cdr))
/* Phase 1 node casting macros */
#define sym_node(n) ((struct mrb_ast_sym_node*)(n))
#define str_node(n) ((struct mrb_ast_str_node*)(n))
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff