Skip to content

Commit 022a6bc

Browse files
committedJul 29, 2013
Fix buggy Class#constants for Object (fixes #304)
1 parent 6c45580 commit 022a6bc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

Diff for: ‎corelib/opal/class.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def constants
177177
else {
178178
own_only = true;
179179
var parent = #{self}._super;
180-
while (parent !== Opal.Object) {
180+
while (parent && (parent !== Opal.Object)) {
181181
scopes.push(parent._scope);
182182
parent = parent._super;
183183
}

Diff for: ‎spec/opal/class/constants_spec.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'spec_helper'
2+
3+
describe "Class#constants" do
4+
it "does not break on Object" do
5+
Object.constants.should be_kind_of(Array)
6+
end
7+
end

0 commit comments

Comments
 (0)
Please sign in to comment.