aboutsummaryrefslogtreecommitdiffstats
path: root/insns.def
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-08-13 22:44:36 -0700
committerJeremy Evans <code@jeremyevans.net>2019-08-14 09:50:14 -0700
commitfbcd0652944568c43a6ae427960d909d62ce6a8d (patch)
tree5c81bdb7b8258c9bc00734c30b69a48c7502632c /insns.def
parent7d32cb7631677172d12010233432b7470046ec2a (diff)
downloadruby-fbcd0652944568c43a6ae427960d909d62ce6a8d.tar.gz
Remove support for nil::Constant
This was an intentional bug added in 1.9. The approach taken here is to add a second operand to the getconstant instruction for whether nil should be allowed and treated as current scope. Fixes [Bug #11718]
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def6
1 files changed, 3 insertions, 3 deletions
diff --git a/insns.def b/insns.def
index 6cfb3b121f..e84fcecfe7 100644
--- a/insns.def
+++ b/insns.def
@@ -252,19 +252,19 @@ setclassvariable
rb_cvar_set(vm_get_cvar_base(vm_get_cref(GET_EP()), GET_CFP()), id, val);
}
-/* Get constant variable id. If klass is Qnil, constants
+/* Get constant variable id. If klass is Qnil and allow_nil is true, constants
are searched in the current scope. Otherwise, get constant under klass
class or module.
*/
DEFINE_INSN
getconstant
-(ID id)
+(ID id, VALUE allow_nil)
(VALUE klass)
(VALUE val)
/* getconstant can kick autoload */
// attr bool leaf = false; /* has rb_autoload_load() */
{
- val = vm_get_ev_const(ec, klass, id, 0);
+ val = vm_get_ev_const(ec, klass, id, allow_nil, 0);
}
/* Set constant variable id under cbase class or module.