1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* node.h (ast_t): renamed to rb_ast_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-10-29 15:51:23 +00:00
parent ad8bc4493d
commit 85fcaf025d
8 changed files with 51 additions and 51 deletions

2
gc.c
View file

@ -434,7 +434,7 @@ typedef struct RVALUE {
const rb_iseq_t iseq;
rb_env_t env;
struct rb_imemo_alloc_struct alloc;
ast_t ast;
rb_ast_t ast;
} imemo;
struct {
struct RBasic basic;

6
iseq.c
View file

@ -641,9 +641,9 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE realpath, VALUE line, c
#else
# define INITIALIZED /* volatile */
#endif
ast_t *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start);
rb_ast_t *(*parse)(VALUE vparser, VALUE fname, VALUE file, int start);
int ln;
ast_t *INITIALIZED ast;
rb_ast_t *INITIALIZED ast;
/* safe results first */
make_compile_option(&option, opt);
@ -854,7 +854,7 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self)
{
VALUE file, line = INT2FIX(1), opt = Qnil;
VALUE parser, f, exc = Qnil, ret;
ast_t *ast;
rb_ast_t *ast;
rb_compile_option_t option;
int i;

4
load.c
View file

@ -602,7 +602,7 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
EC_PUSH_TAG(th->ec);
state = EXEC_TAG();
if (state == TAG_NONE) {
ast_t *ast;
rb_ast_t *ast;
const rb_iseq_t *iseq;
if ((iseq = rb_iseq_load_iseq(fname)) != NULL) {
@ -611,7 +611,7 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
else {
VALUE parser = rb_parser_new();
rb_parser_set_context(parser, NULL, FALSE);
ast = (ast_t *)rb_parser_load_file(parser, fname);
ast = (rb_ast_t *)rb_parser_load_file(parser, fname);
iseq = rb_iseq_new_top(ast->root, rb_fstring_cstr("<top (required)>"),
fname, rb_realpath_internal(Qnil, fname, 1), NULL);
rb_ast_dispose(ast);

18
node.c
View file

@ -1248,7 +1248,7 @@ rb_node_buffer_free(node_buffer_t *nb)
}
NODE *
rb_ast_newnode(ast_t *ast)
rb_ast_newnode(rb_ast_t *ast)
{
node_buffer_t *nb = ast->node_buffer;
if (nb->idx >= nb->len) {
@ -1264,27 +1264,27 @@ rb_ast_newnode(ast_t *ast)
}
void
rb_ast_delete_node(ast_t *ast, NODE *n)
rb_ast_delete_node(rb_ast_t *ast, NODE *n)
{
(void)ast;
(void)n;
/* should we implement freelist? */
}
ast_t *
rb_ast_t *
rb_ast_new(void)
{
return (ast_t *)rb_imemo_new(imemo_ast, 0, (VALUE)rb_node_buffer_new(), rb_ary_tmp_new(0), 0);
return (rb_ast_t *)rb_imemo_new(imemo_ast, 0, (VALUE)rb_node_buffer_new(), rb_ary_tmp_new(0), 0);
}
void
rb_ast_mark(ast_t *ast)
rb_ast_mark(rb_ast_t *ast)
{
if (ast->node_buffer) rb_gc_mark(ast->mark_ary);
}
void
rb_ast_free(ast_t *ast)
rb_ast_free(rb_ast_t *ast)
{
if (ast->node_buffer) rb_node_buffer_free(ast->node_buffer);
ast->node_buffer = 0;
@ -1293,20 +1293,20 @@ rb_ast_free(ast_t *ast)
}
void
rb_ast_dispose(ast_t *ast)
rb_ast_dispose(rb_ast_t *ast)
{
rb_ast_free(ast);
rb_gc_writebarrier_remember((VALUE)ast);
}
void
rb_ast_add_mark_object(ast_t *ast, VALUE obj)
rb_ast_add_mark_object(rb_ast_t *ast, VALUE obj)
{
rb_ary_push(ast->mark_ary, obj);
}
void
rb_ast_delete_mark_object(ast_t *ast, VALUE obj)
rb_ast_delete_mark_object(rb_ast_t *ast, VALUE obj)
{
long i;
for (i = 0; i < RARRAY_LEN(ast->mark_ary); i++) {

36
node.h
View file

@ -441,21 +441,21 @@ RUBY_SYMBOL_EXPORT_BEGIN
typedef struct node_buffer_struct node_buffer_t;
/* T_IMEMO/ast */
typedef struct ast_struct {
typedef struct rb_ast_struct {
VALUE flags;
VALUE reserved1;
NODE *root;
node_buffer_t *node_buffer;
VALUE mark_ary;
} ast_t;
ast_t *rb_ast_new();
void rb_ast_mark(ast_t*);
void rb_ast_dispose(ast_t*);
void rb_ast_free(ast_t*);
void rb_ast_add_mark_object(ast_t*, VALUE);
void rb_ast_delete_mark_object(ast_t*, VALUE);
NODE *rb_ast_newnode(ast_t*);
void rb_ast_delete_node(ast_t*, NODE *n);
} rb_ast_t;
rb_ast_t *rb_ast_new();
void rb_ast_mark(rb_ast_t*);
void rb_ast_dispose(rb_ast_t*);
void rb_ast_free(rb_ast_t*);
void rb_ast_add_mark_object(rb_ast_t*, VALUE);
void rb_ast_delete_mark_object(rb_ast_t*, VALUE);
NODE *rb_ast_newnode(rb_ast_t*);
void rb_ast_delete_node(rb_ast_t*, NODE *n);
VALUE rb_parser_new(void);
VALUE rb_parser_end_seen_p(VALUE);
@ -465,15 +465,15 @@ VALUE rb_parser_set_yydebug(VALUE, VALUE);
VALUE rb_parser_dump_tree(NODE *node, int comment);
void rb_parser_set_options(VALUE, int, int, int, int);
ast_t *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
ast_t *rb_parser_compile_file(VALUE, const char*, VALUE, int);
ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
rb_ast_t *rb_parser_compile_cstr(VALUE, const char*, const char*, int, int);
rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
rb_ast_t *rb_parser_compile_file(VALUE, const char*, VALUE, int);
rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
ast_t *rb_compile_cstr(const char*, const char*, int, int);
ast_t *rb_compile_string(const char*, VALUE, int);
ast_t *rb_compile_file(const char*, VALUE, int);
rb_ast_t *rb_compile_cstr(const char*, const char*, int, int);
rb_ast_t *rb_compile_string(const char*, VALUE, int);
rb_ast_t *rb_compile_file(const char*, VALUE, int);
void rb_node_init(NODE *n, enum node_type type, VALUE a0, VALUE a1, VALUE a2);
NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);

24
parse.y
View file

@ -239,7 +239,7 @@ struct parser_params {
unsigned int do_chomp: 1;
unsigned int do_split: 1;
ast_t *ast;
rb_ast_t *ast;
NODE *eval_tree_begin;
NODE *eval_tree;
VALUE error_buffer;
@ -5589,11 +5589,11 @@ lex_getline(struct parser_params *parser)
static const rb_data_type_t parser_data_type;
#ifndef RIPPER
static ast_t*
static rb_ast_t*
parser_compile_string(VALUE vparser, VALUE fname, VALUE s, int line)
{
struct parser_params *parser;
ast_t *ast;
rb_ast_t *ast;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser);
parser->ast = ast = rb_ast_new();
@ -5610,34 +5610,34 @@ parser_compile_string(VALUE vparser, VALUE fname, VALUE s, int line)
return ast;
}
ast_t*
rb_ast_t*
rb_compile_string(const char *f, VALUE s, int line)
{
must_be_ascii_compatible(s);
return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), s, line);
}
ast_t*
rb_ast_t*
rb_parser_compile_string(VALUE vparser, const char *f, VALUE s, int line)
{
return rb_parser_compile_string_path(vparser, rb_filesystem_str_new_cstr(f), s, line);
}
ast_t*
rb_ast_t*
rb_parser_compile_string_path(VALUE vparser, VALUE f, VALUE s, int line)
{
must_be_ascii_compatible(s);
return parser_compile_string(vparser, f, s, line);
}
ast_t*
rb_ast_t*
rb_compile_cstr(const char *f, const char *s, int len, int line)
{
VALUE str = rb_str_new(s, len);
return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), str, line);
}
ast_t*
rb_ast_t*
rb_parser_compile_cstr(VALUE vparser, const char *f, const char *s, int len, int line)
{
VALUE str = rb_str_new(s, len);
@ -5652,7 +5652,7 @@ lex_io_gets(struct parser_params *parser, VALUE io)
return rb_io_gets_internal(io);
}
ast_t*
rb_ast_t*
rb_compile_file(const char *f, VALUE file, int start)
{
VALUE vparser = rb_parser_new();
@ -5660,17 +5660,17 @@ rb_compile_file(const char *f, VALUE file, int start)
return rb_parser_compile_file(vparser, f, file, start);
}
ast_t*
rb_ast_t*
rb_parser_compile_file(VALUE vparser, const char *f, VALUE file, int start)
{
return rb_parser_compile_file_path(vparser, rb_filesystem_str_new_cstr(f), file, start);
}
ast_t*
rb_ast_t*
rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE file, int start)
{
struct parser_params *parser;
ast_t *ast;
rb_ast_t *ast;
TypedData_Get_Struct(vparser, struct parser_params, &parser_data_type, parser);
parser->ast = ast = rb_ast_new();

10
ruby.c
View file

@ -177,7 +177,7 @@ cmdline_options_init(ruby_cmdline_options_t *opt)
return opt;
}
static ast_t *load_file(VALUE parser, VALUE fname, VALUE f, int script,
static rb_ast_t *load_file(VALUE parser, VALUE fname, VALUE f, int script,
ruby_cmdline_options_t *opt);
static VALUE open_load_file(VALUE fname_v, int *xflag);
static void forbid_setid(const char *, const ruby_cmdline_options_t *);
@ -1461,7 +1461,7 @@ rb_f_chomp(int argc, VALUE *argv)
static VALUE
process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
{
ast_t *ast = 0;
rb_ast_t *ast = 0;
VALUE parser;
VALUE script_name;
const rb_iseq_t *iseq;
@ -1797,7 +1797,7 @@ load_file_internal(VALUE argp_v)
ruby_cmdline_options_t *opt = argp->opt;
VALUE f = argp->f;
int line_start = 1;
ast_t *ast = 0;
rb_ast_t *ast = 0;
rb_encoding *enc;
ID set_encoding;
@ -2011,7 +2011,7 @@ restore_load_file(VALUE arg)
return Qnil;
}
static ast_t *
static rb_ast_t *
load_file(VALUE parser, VALUE fname, VALUE f, int script, ruby_cmdline_options_t *opt)
{
struct load_file_arg arg;
@ -2020,7 +2020,7 @@ load_file(VALUE parser, VALUE fname, VALUE f, int script, ruby_cmdline_options_t
arg.script = script;
arg.opt = opt;
arg.f = f;
return (ast_t *)rb_ensure(load_file_internal, (VALUE)&arg,
return (rb_ast_t *)rb_ensure(load_file_internal, (VALUE)&arg,
restore_load_file, (VALUE)&arg);
}

View file

@ -121,7 +121,7 @@ prelude_eval(VALUE code, VALUE name, int line)
FALSE, /* int debug_frozen_string_literal; */
};
ast_t *ast = rb_parser_compile_string_path(rb_parser_new(), name, code, line);
rb_ast_t *ast = rb_parser_compile_string_path(rb_parser_new(), name, code, line);
if (!ast->root) {
rb_ast_dispose(ast);
rb_exc_raise(rb_errinfo());