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:
parent
ed9d9cee76
commit
1b300789ff
2 changed files with 2 additions and 2 deletions
2
ast.c
2
ast.c
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue