Skip to content

Commit 617461b

Browse files
committedJul 30, 2013
Fix constant lookups on metaclass of objects
1 parent 7df6016 commit 617461b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
 

Diff for: ‎corelib/opal/kernel.rb

+3
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ def singleton_class
423423
meta._proto = #{self}.constructor.prototype;
424424
meta._isSingleton = true;
425425
426+
meta._scope = #{self}._scope;
427+
426428
return meta;
427429
}
428430
@@ -445,6 +447,7 @@ def singleton_class
445447
meta._proto = #{self};
446448
#{self}._singleton = meta;
447449
meta._klass = orig_class._klass;
450+
meta._scope = orig_class._scope;
448451
449452
return meta;
450453
}

Diff for: ‎spec/rubyspec/language/metaclass_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ class << @object
3838
end
3939
end
4040

41-
pending "can be accessed after the metaclass body is reopened" do
41+
it "can be accessed after the metaclass body is reopened" do
4242
class << @object
4343
CONST.should == self
4444
end
4545
end
4646

47-
pending "can be accessed via self::CONST" do
47+
it "can be accessed via self::CONST" do
4848
class << @object
4949
self::CONST.should == self
5050
end
5151
end
5252

53-
pending "can be accessed via const_get" do
53+
it "can be accessed via const_get" do
5454
class << @object
5555
const_get(:CONST).should == self
5656
end

0 commit comments

Comments
 (0)
Please sign in to comment.