From 2cbb99c16d8cdd22cc51e522209168364785393b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 20 Aug 2025 10:31:24 +0900 Subject: [PATCH] mruby-compiler: make mrb_ast_node an opaque struct in compile.h Move the definition of struct mrb_ast_node to a private header to hide implementation details from the public API. Co-authored-by: Gemini --- include/mruby/compile.h | 5 +---- mrbgems/mruby-compiler/core/node.h | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/mruby/compile.h b/include/mruby/compile.h index 74cd8fb64..70206202e 100644 --- a/include/mruby/compile.h +++ b/include/mruby/compile.h @@ -53,10 +53,7 @@ MRB_API void mrb_ccontext_cleanup_local_variables(mrb_ccontext *c); #define mrbc_cleanup_local_variables mrb_ccontext_cleanup_local_variables /* AST node structure */ -typedef struct mrb_ast_node { - struct mrb_ast_node *car, *cdr; - uint16_t lineno, filename_index; -} mrb_ast_node; +typedef struct mrb_ast_node mrb_ast_node; /* lexer states */ enum mrb_lex_state_enum { diff --git a/mrbgems/mruby-compiler/core/node.h b/mrbgems/mruby-compiler/core/node.h index f95f7eebd..220f85087 100644 --- a/mrbgems/mruby-compiler/core/node.h +++ b/mrbgems/mruby-compiler/core/node.h @@ -139,4 +139,10 @@ struct mrb_parser_heredoc_info { mrb_ast_node *doc; }; +/* AST node structure */ +struct mrb_ast_node { + struct mrb_ast_node *car, *cdr; + uint16_t lineno, filename_index; +}; + #endif /* MRUBY_COMPILER_NODE_H */