From 1b300789ffc5fda1fcb534d0611ffdb7731e5b9d Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Sat, 18 Sep 2021 21:52:18 +0900 Subject: ast.c: AST.of against C method should return nil (as Ruby 2.6--3.0) --- ast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ast.c') diff --git a/ast.c b/ast.c index e1c044e24c..84e5fdcecc 100644 --- a/ast.c +++ b/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"); -- cgit v1.2.3