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

ast.c: AST.of against C method should return nil (as Ruby 2.6--3.0)

This commit is contained in:
Yusuke Endoh 2021-09-18 21:52:18 +09:00
parent ed9d9cee76
commit 1b300789ff
2 changed files with 2 additions and 2 deletions

2
ast.c
View file

@ -214,7 +214,7 @@ ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE keep_script
iseq = rb_method_iseq(body);
}
if (!iseq) {
rb_raise(rb_eArgError, "cannot get AST for method that is not defined in Ruby");
return Qnil;
}
if (rb_iseq_from_eval_p(iseq)) {
rb_raise(rb_eArgError, "cannot get AST for method defined in eval");

View file

@ -233,7 +233,7 @@ class TestAst < Test::Unit::TestCase
def test_of_c_method
c = Class.new { attr_reader :foo }
assert_raise(ArgumentError) { RubyVM::AbstractSyntaxTree.of(c.instance_method(:foo)) }
assert_nil(RubyVM::AbstractSyntaxTree.of(c.instance_method(:foo)))
end
def test_scope_local_variables