Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion insns.def
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,14 @@ defined
}
break;
case DEFINED_CVAR:
klass = vm_get_cbase(GET_ISEQ(), GET_LFP(), GET_DFP());
{
NODE *cref = vm_get_cref(GET_ISEQ(), GET_LFP(), GET_DFP());
klass = vm_get_cvar_base(cref);
if (rb_cvar_defined(klass, SYM2ID(obj))) {
expr_type = "class variable";
}
break;
}
case DEFINED_CONST:
klass = v;
if (vm_get_ev_const(th, GET_ISEQ(), klass, SYM2ID(obj), 1)) {
Expand Down
5 changes: 5 additions & 0 deletions test/ruby/test_variable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def test_variable
assert_equal("Cronus", atlas.ruler0)
assert_equal("Zeus", atlas.ruler3)
assert_equal("Cronus", atlas.ruler4)
assert_nothing_raised do
class << Gods
defined?(@@rule) && @@rule
end
end
end

def test_local_variables
Expand Down