summaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 32d8ab9eb6..20c4588cd7 100644
--- a/ast.c
+++ b/ast.c
@@ -213,6 +213,9 @@ ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE save_script
else {
iseq = rb_method_iseq(body);
}
+ if (rb_iseq_from_eval_p(iseq)) {
+ rb_raise(rb_eArgError, "cannot get AST for method defined in eval");
+ }
path = rb_iseq_path(iseq);
node_id = iseq->body->location.node_id;
}