зеркало из https://github.com/github/ruby.git
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]
This commit is contained in:
Родитель
46845d03c2
Коммит
ce072fe568
|
@ -2188,10 +2188,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
[__FILE__+"/instance_eval", eval_script],
|
||||
[__FILE__+"/class_eval", eval_script],
|
||||
], events
|
||||
|
||||
events.clear
|
||||
tp.enable{
|
||||
begin
|
||||
eval('a=')
|
||||
rescue SyntaxError
|
||||
end
|
||||
}
|
||||
assert_equal [], events, 'script_compiled event should not be invoked on compile error'
|
||||
|
||||
skip "TODO: test for requires"
|
||||
|
||||
events.clear
|
||||
tp.enable{
|
||||
require ''
|
||||
require_relative ''
|
||||
|
|
14
vm_eval.c
14
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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче