Project

General

Profile

Bug #9321 ยป rb_mod_const_missing_with_tests.patch

drkaes (Stefan Kaes), 12/30/2013 08:05 PM

View differences:

test/ruby/test_settracefunc.rb
1066 1066
      :b_return
1067 1067
    ], events)
1068 1068
  end
1069

  
1070
  def test_const_missing
1071
    bug59398 = '[ruby-core:59398]'
1072
    events = []
1073
    assert !defined?(MISSING_CONSTANT_59398)
1074
    TracePoint.new(:c_call, :c_return){|tp|
1075
      events << tp.event if tp.defined_class == Module && tp.method_id == :const_missing
1076
    }.enable{
1077
      MISSING_CONSTANT_59398 rescue nil
1078
    }
1079
    assert_equal([
1080
      :c_call,
1081
      :c_return
1082
    ], events, bug59398)
1083
  end
1069 1084
end
variable.c
19 19
#include "constant.h"
20 20
#include "internal.h"
21 21
#include "id.h"
22
#include "vm_core.h"
22 23

  
23 24
st_table *rb_global_tbl;
24 25
static ID autoload, classpath, tmp_classpath, classid;
......
1518 1519
VALUE
1519 1520
rb_mod_const_missing(VALUE klass, VALUE name)
1520 1521
{
1522
    rb_thread_t *th = GET_THREAD();
1523
    EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, rb_cModule, idConst_missing, rb_cModule, Qnil);
1521 1524
    rb_frame_pop(); /* pop frame for "const_missing" */
1522 1525
    uninitialized_constant(klass, rb_to_id(name));
1523 1526