NameError#receiver of uninitialized constant

* error.c (name_err_mesg_to_str): quote the name if unprintable.
* object.c (check_setter_id): use rb_check_id to convert names.
* variable.c (uninitialized_constant): use NameError::message to
  keep the receiver of uninitialized constant.  [Feature #10881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-28 06:24:12 +00:00
parent 7a929727f6
commit 72ff61f4a8
11 changed files with 206 additions and 237 deletions

View file

@ -671,6 +671,10 @@ end.join
obj.instance_eval("Object")
}
assert_equal(:Object, e.name)
e = assert_raise(NameError) {
BasicObject::X
}
assert_same(BasicObject, e.receiver)
e = assert_raise(NameError) {
obj.instance_eval {foo}
}