diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2021-09-18 21:28:35 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2021-09-18 21:28:35 +0900 |
commit | ed9d9cee76ee941c504ccea33c70c0eb5d825813 (patch) | |
tree | 2233a3f509d49be4a3cc40926746dfa5f8d49209 /ast.c | |
parent | 1c07c98229aa16bf13cbd3997d32230d5324b4f2 (diff) |
ast.c: AST.of checks if a given method object is defined in C
[Bug #18178]
Diffstat (limited to 'ast.c')
-rw-r--r-- | ast.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -213,6 +213,9 @@ ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE keep_script else { iseq = rb_method_iseq(body); } + if (!iseq) { + rb_raise(rb_eArgError, "cannot get AST for method that is not defined in Ruby"); + } if (rb_iseq_from_eval_p(iseq)) { rb_raise(rb_eArgError, "cannot get AST for method defined in eval"); } |