mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Hoisted out rb_ast_parse_str and rb_ast_parse_file
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
51902ea5c9
commit
49c7c8ed85
1 changed files with 16 additions and 1 deletions
17
ast.c
17
ast.c
|
@ -52,6 +52,9 @@ ast_new_internal(rb_ast_t *ast, NODE *node)
|
|||
return obj;
|
||||
}
|
||||
|
||||
VALUE rb_ast_parse_str(VALUE str);
|
||||
VALUE rb_ast_parse_file(VALUE path);
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* RubyVM::AbstractSyntaxTree.parse(string) -> RubyVM::AbstractSyntaxTree::Node
|
||||
|
@ -66,6 +69,12 @@ ast_new_internal(rb_ast_t *ast, NODE *node)
|
|||
*/
|
||||
static VALUE
|
||||
rb_ast_s_parse(VALUE module, VALUE str)
|
||||
{
|
||||
return rb_ast_parse_str(str);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_ast_parse_str(VALUE str)
|
||||
{
|
||||
VALUE obj;
|
||||
rb_ast_t *ast = 0;
|
||||
|
@ -101,6 +110,12 @@ rb_ast_s_parse(VALUE module, VALUE str)
|
|||
*/
|
||||
static VALUE
|
||||
rb_ast_s_parse_file(VALUE module, VALUE path)
|
||||
{
|
||||
return rb_ast_parse_file(path);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_ast_parse_file(VALUE path)
|
||||
{
|
||||
VALUE obj, f;
|
||||
rb_ast_t *ast = 0;
|
||||
|
@ -174,7 +189,7 @@ rb_ast_s_of(VALUE module, VALUE body)
|
|||
|
||||
path = rb_iseq_path(iseq);
|
||||
node_id = iseq->body->location.node_id;
|
||||
node = rb_ast_s_parse_file(module, path);
|
||||
node = rb_ast_parse_file(path);
|
||||
|
||||
return node_find(node, node_id);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue