ruby-changes:53430
From: nobu <ko1@a...>
Date: Fri, 9 Nov 2018 22:39:41 +0900 (JST)
Subject: [ruby-changes:53430] nobu:r65646 (trunk): Hoisted out rb_ast_parse_str and rb_ast_parse_file
nobu 2018-11-09 22:39:35 +0900 (Fri, 09 Nov 2018) New Revision: 65646 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65646 Log: Hoisted out rb_ast_parse_str and rb_ast_parse_file Modified files: trunk/ast.c Index: ast.c =================================================================== --- ast.c (revision 65645) +++ ast.c (revision 65646) @@ -52,6 +52,9 @@ ast_new_internal(rb_ast_t *ast, NODE *no https://github.com/ruby/ruby/blob/trunk/ast.c#L52 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 @@ -67,6 +70,12 @@ ast_new_internal(rb_ast_t *ast, NODE *no https://github.com/ruby/ruby/blob/trunk/ast.c#L70 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; @@ -102,6 +111,12 @@ rb_ast_s_parse(VALUE module, VALUE str) https://github.com/ruby/ruby/blob/trunk/ast.c#L111 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; rb_encoding *enc = rb_utf8_encoding(); @@ -174,7 +189,7 @@ rb_ast_s_of(VALUE module, VALUE body) https://github.com/ruby/ruby/blob/trunk/ast.c#L189 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/