summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJemma Issroff <[email protected]>2023-10-25 11:23:57 -0300
committerJemma Issroff <[email protected]>2023-10-25 18:18:35 -0300
commit8f71a5c53007b072341775e4161ec20b50ffc538 (patch)
tree711e0e6e3e61bf109a7e708313f56c24adbb6c90
parent0abf2d86b963089a52af9ee221d1b7da7ba9b2ee (diff)
[PRISM] Move scope_node itself to CRuby, create prism_compile.h
-rw-r--r--common.mk3
-rw-r--r--compile.c2
-rw-r--r--iseq.c4
-rw-r--r--prism/node.h17
-rw-r--r--prism_compile.h20
-rw-r--r--ruby.c2
6 files changed, 26 insertions, 22 deletions
diff --git a/common.mk b/common.mk
index 5c9afaa280..0f8c0ada32 100644
--- a/common.mk
+++ b/common.mk
@@ -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
diff --git a/compile.c b/compile.c
index 94a7a87229..4b36e4ebd1 100644
--- a/compile.c
+++ b/compile.c
@@ -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
diff --git a/iseq.c b/iseq.c
index 933e5c99d4..dd8ebcd0b8 100644
--- a/iseq.c
+++ b/iseq.c
@@ -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);
diff --git a/ruby.c b/ruby.c
index b4f78b3415..18ad61de80 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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"