aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-01-06 11:36:51 +0900
committerKoichi Sasada <ko1@atdot.net>2020-01-06 11:36:51 +0900
commitce072fe5689184cba5e4a86968367c525cb22a72 (patch)
tree3f9cabe287445791e67e4dd2b85625c07e60ea9e /vm_eval.c
parent46845d03c20bf7d157a040762f33a8d2fb2c3de8 (diff)
downloadruby-ce072fe5689184cba5e4a86968367c525cb22a72.tar.gz
script_compiled event on compile error.
script_compiled event for TracePoint should not be invoked on compile error (SyntaxError) because it is not "compiled". [Bug #16459]
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 1f5c4cf2ba..85c317d3ee 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1486,7 +1486,7 @@ eval_make_iseq(VALUE src, VALUE fname, int line, const rb_binding_t *bind,
const VALUE parser = rb_parser_new();
const rb_iseq_t *const parent = vm_block_iseq(base_block);
VALUE realpath = Qnil;
- rb_iseq_t *iseq = 0;
+ rb_iseq_t *iseq = NULL;
rb_ast_t *ast;
if (!fname) {
@@ -1511,12 +1511,14 @@ eval_make_iseq(VALUE src, VALUE fname, int line, const rb_binding_t *bind,
}
rb_ast_dispose(ast);
- if (0 && iseq) { /* for debug */
- VALUE disasm = rb_iseq_disasm(iseq);
- printf("%s\n", StringValuePtr(disasm));
- }
+ if (iseq != NULL) {
+ if (0 && iseq) { /* for debug */
+ VALUE disasm = rb_iseq_disasm(iseq);
+ printf("%s\n", StringValuePtr(disasm));
+ }
- rb_exec_event_hook_script_compiled(GET_EC(), iseq, src);
+ rb_exec_event_hook_script_compiled(GET_EC(), iseq, src);
+ }
return iseq;
}