[PRISM] Move scope_node itself to CRuby, create prism_compile.h
This commit is contained in:
parent
0abf2d86b9
commit
8f71a5c530
@ -3415,6 +3415,7 @@ compile.$(OBJEXT): {$(VPATH)}prism/ast.h
|
|||||||
compile.$(OBJEXT): {$(VPATH)}prism/prism.h
|
compile.$(OBJEXT): {$(VPATH)}prism/prism.h
|
||||||
compile.$(OBJEXT): {$(VPATH)}prism/version.h
|
compile.$(OBJEXT): {$(VPATH)}prism/version.h
|
||||||
compile.$(OBJEXT): {$(VPATH)}prism_compile.c
|
compile.$(OBJEXT): {$(VPATH)}prism_compile.c
|
||||||
|
compile.$(OBJEXT): {$(VPATH)}prism_compile.h
|
||||||
compile.$(OBJEXT): {$(VPATH)}re.h
|
compile.$(OBJEXT): {$(VPATH)}re.h
|
||||||
compile.$(OBJEXT): {$(VPATH)}regex.h
|
compile.$(OBJEXT): {$(VPATH)}regex.h
|
||||||
compile.$(OBJEXT): {$(VPATH)}ruby_assert.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/ast.h
|
||||||
iseq.$(OBJEXT): {$(VPATH)}prism/prism.h
|
iseq.$(OBJEXT): {$(VPATH)}prism/prism.h
|
||||||
iseq.$(OBJEXT): {$(VPATH)}prism/version.h
|
iseq.$(OBJEXT): {$(VPATH)}prism/version.h
|
||||||
|
iseq.$(OBJEXT): {$(VPATH)}prism_compile.h
|
||||||
iseq.$(OBJEXT): {$(VPATH)}ractor.h
|
iseq.$(OBJEXT): {$(VPATH)}ractor.h
|
||||||
iseq.$(OBJEXT): {$(VPATH)}rjit.h
|
iseq.$(OBJEXT): {$(VPATH)}rjit.h
|
||||||
iseq.$(OBJEXT): {$(VPATH)}ruby_assert.h
|
iseq.$(OBJEXT): {$(VPATH)}ruby_assert.h
|
||||||
@ -15496,6 +15498,7 @@ ruby.$(OBJEXT): {$(VPATH)}onigmo.h
|
|||||||
ruby.$(OBJEXT): {$(VPATH)}oniguruma.h
|
ruby.$(OBJEXT): {$(VPATH)}oniguruma.h
|
||||||
ruby.$(OBJEXT): {$(VPATH)}prism/ast.h
|
ruby.$(OBJEXT): {$(VPATH)}prism/ast.h
|
||||||
ruby.$(OBJEXT): {$(VPATH)}prism/version.h
|
ruby.$(OBJEXT): {$(VPATH)}prism/version.h
|
||||||
|
ruby.$(OBJEXT): {$(VPATH)}prism_compile.h
|
||||||
ruby.$(OBJEXT): {$(VPATH)}rjit.h
|
ruby.$(OBJEXT): {$(VPATH)}rjit.h
|
||||||
ruby.$(OBJEXT): {$(VPATH)}ruby.c
|
ruby.$(OBJEXT): {$(VPATH)}ruby.c
|
||||||
ruby.$(OBJEXT): {$(VPATH)}ruby_assert.h
|
ruby.$(OBJEXT): {$(VPATH)}ruby_assert.h
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "insns.inc"
|
#include "insns.inc"
|
||||||
#include "insns_info.inc"
|
#include "insns_info.inc"
|
||||||
#include "prism/prism.h"
|
#include "prism_compile.h"
|
||||||
|
|
||||||
#undef RUBY_UNTYPED_DATA_WARNING
|
#undef RUBY_UNTYPED_DATA_WARNING
|
||||||
#define RUBY_UNTYPED_DATA_WARNING 0
|
#define RUBY_UNTYPED_DATA_WARNING 0
|
||||||
|
4
iseq.c
4
iseq.c
@ -43,7 +43,7 @@
|
|||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "insns.inc"
|
#include "insns.inc"
|
||||||
#include "insns_info.inc"
|
#include "insns_info.inc"
|
||||||
#include "prism/prism.h"
|
#include "prism_compile.h"
|
||||||
|
|
||||||
VALUE rb_cISeq;
|
VALUE rb_cISeq;
|
||||||
static VALUE iseqw_new(const rb_iseq_t *iseq);
|
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));
|
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
|
static VALUE
|
||||||
iseqw_s_compile_prism(int argc, VALUE *argv, VALUE self)
|
iseqw_s_compile_prism(int argc, VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
|
17
prism/node.h
17
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 })
|
#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
|
#endif // PRISM_NODE_H
|
||||||
|
20
prism_compile.h
Normal file
20
prism_compile.h
Normal file
@ -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);
|
2
ruby.c
2
ruby.c
@ -56,7 +56,7 @@
|
|||||||
#include "internal/thread.h"
|
#include "internal/thread.h"
|
||||||
#include "internal/ruby_parser.h"
|
#include "internal/ruby_parser.h"
|
||||||
#include "internal/variable.h"
|
#include "internal/variable.h"
|
||||||
#include "prism/prism.h"
|
#include "prism_compile.h"
|
||||||
#include "ruby/encoding.h"
|
#include "ruby/encoding.h"
|
||||||
#include "ruby/thread.h"
|
#include "ruby/thread.h"
|
||||||
#include "ruby/util.h"
|
#include "ruby/util.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user