diff options
author | Jemma Issroff <[email protected]> | 2023-10-25 11:23:57 -0300 |
---|---|---|
committer | Jemma Issroff <[email protected]> | 2023-10-25 18:18:35 -0300 |
commit | 8f71a5c53007b072341775e4161ec20b50ffc538 (patch) | |
tree | 711e0e6e3e61bf109a7e708313f56c24adbb6c90 | |
parent | 0abf2d86b963089a52af9ee221d1b7da7ba9b2ee (diff) |
[PRISM] Move scope_node itself to CRuby, create prism_compile.h
-rw-r--r-- | common.mk | 3 | ||||
-rw-r--r-- | compile.c | 2 | ||||
-rw-r--r-- | iseq.c | 4 | ||||
-rw-r--r-- | prism/node.h | 17 | ||||
-rw-r--r-- | prism_compile.h | 20 | ||||
-rw-r--r-- | ruby.c | 2 |
6 files changed, 26 insertions, 22 deletions
@@ -3415,6 +3415,7 @@ compile.$(OBJEXT): {$(VPATH)}prism/ast.h compile.$(OBJEXT): {$(VPATH)}prism/prism.h compile.$(OBJEXT): {$(VPATH)}prism/version.h compile.$(OBJEXT): {$(VPATH)}prism_compile.c +compile.$(OBJEXT): {$(VPATH)}prism_compile.h compile.$(OBJEXT): {$(VPATH)}re.h compile.$(OBJEXT): {$(VPATH)}regex.h compile.$(OBJEXT): {$(VPATH)}ruby_assert.h @@ -8461,6 +8462,7 @@ iseq.$(OBJEXT): {$(VPATH)}oniguruma.h iseq.$(OBJEXT): {$(VPATH)}prism/ast.h iseq.$(OBJEXT): {$(VPATH)}prism/prism.h iseq.$(OBJEXT): {$(VPATH)}prism/version.h +iseq.$(OBJEXT): {$(VPATH)}prism_compile.h iseq.$(OBJEXT): {$(VPATH)}ractor.h iseq.$(OBJEXT): {$(VPATH)}rjit.h iseq.$(OBJEXT): {$(VPATH)}ruby_assert.h @@ -15496,6 +15498,7 @@ ruby.$(OBJEXT): {$(VPATH)}onigmo.h ruby.$(OBJEXT): {$(VPATH)}oniguruma.h ruby.$(OBJEXT): {$(VPATH)}prism/ast.h ruby.$(OBJEXT): {$(VPATH)}prism/version.h +ruby.$(OBJEXT): {$(VPATH)}prism_compile.h ruby.$(OBJEXT): {$(VPATH)}rjit.h ruby.$(OBJEXT): {$(VPATH)}ruby.c ruby.$(OBJEXT): {$(VPATH)}ruby_assert.h @@ -44,7 +44,7 @@ #include "builtin.h" #include "insns.inc" #include "insns_info.inc" -#include "prism/prism.h" +#include "prism_compile.h" #undef RUBY_UNTYPED_DATA_WARNING #define RUBY_UNTYPED_DATA_WARNING 0 @@ -43,7 +43,7 @@ #include "builtin.h" #include "insns.inc" #include "insns_info.inc" -#include "prism/prism.h" +#include "prism_compile.h" VALUE rb_cISeq; static VALUE iseqw_new(const rb_iseq_t *iseq); @@ -1391,8 +1391,6 @@ iseqw_s_compile(int argc, VALUE *argv, VALUE self) return iseqw_new(rb_iseq_compile_with_option(src, file, path, line, opt)); } -void pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_t *previous, pm_parser_t *parser); - static VALUE iseqw_s_compile_prism(int argc, VALUE *argv, VALUE self) { diff --git a/prism/node.h b/prism/node.h index 403e84e0d3..71b364046a 100644 --- a/prism/node.h +++ b/prism/node.h @@ -29,21 +29,4 @@ PRISM_EXPORTED_FUNCTION const char * pm_node_type_to_str(pm_node_type_t node_typ #define PM_EMPTY_NODE_LIST ((pm_node_list_t) { .nodes = NULL, .size = 0, .capacity = 0 }) -// ScopeNodes are helper nodes, and will never be part of the AST. We manually -// declare them here to avoid generating them. -typedef struct pm_scope_node { - pm_node_t base; - struct pm_scope_node *previous; - pm_node_t *ast_node; - struct pm_parameters_node *parameters; - pm_node_t *body; - pm_constant_id_list_t locals; - pm_parser_t *parser; - - // We don't have the CRuby types ID and st_table within Prism - // so we use void * - void *constants; // ID *constants - void *index_lookup_table; // st_table *index_lookup_table -} pm_scope_node_t; - #endif // PRISM_NODE_H diff --git a/prism_compile.h b/prism_compile.h new file mode 100644 index 0000000000..dcafa85555 --- /dev/null +++ b/prism_compile.h @@ -0,0 +1,20 @@ +#include "prism/prism.h" + +// ScopeNodes are helper nodes, and will never be part of the AST. We manually +// declare them here to avoid generating them. +typedef struct pm_scope_node { + pm_node_t base; + struct pm_scope_node *previous; + pm_node_t *ast_node; + struct pm_parameters_node *parameters; + pm_node_t *body; + pm_constant_id_list_t locals; + pm_parser_t *parser; + + // We don't have the CRuby types ID and st_table within Prism + // so we use void * + void *constants; // ID *constants + void *index_lookup_table; // st_table *index_lookup_table +} pm_scope_node_t; + +void pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_t *previous, pm_parser_t *parser); @@ -56,7 +56,7 @@ #include "internal/thread.h" #include "internal/ruby_parser.h" #include "internal/variable.h" -#include "prism/prism.h" +#include "prism_compile.h" #include "ruby/encoding.h" #include "ruby/thread.h" #include "ruby/util.h" |