diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-23 15:05:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-07-23 15:05:03 +0000 |
commit | 4dc1a2180946ab793adee5eb235fc4ee8fa4cefe (patch) | |
tree | 7c078ba1c20373d9c36610c6c98de775e9f44a51 /error.c | |
parent | a7c15b2617620b79ea734faf31dacc8e72ed5ad1 (diff) |
* error.c (rb_name_error_str): new function to raise NameError
with the name string but not ID.
* object.c, proc.c, variable.c: more removal of inadvertent symbol
creation. [Feature #5079]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -812,6 +812,21 @@ rb_name_error(ID id, const char *fmt, ...) rb_exc_raise(exc); } +void +rb_name_error_str(VALUE str, const char *fmt, ...) +{ + VALUE exc, argv[2]; + va_list args; + + va_start(args, fmt); + argv[0] = rb_vsprintf(fmt, args); + va_end(args); + + argv[1] = str; + exc = rb_class_new_instance(2, argv, rb_eNameError); + rb_exc_raise(exc); +} + /* * call-seq: * NameError.new(msg [, name]) -> name_error |