Skip to content

Commit 6580956

Browse files
author
Yorick Peterse
committedJul 24, 2015
Mark nil/true/false as frozen
Interesting enough MRI still lets you define methods on these objects even when they're frozen. For example, this works just fine: def nil.foo end nil.foo
1 parent 6370559 commit 6580956

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎vm/builtin/object.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ namespace rubinius {
167167
Object* Object::frozen_p(STATE) {
168168
if(reference_p()) {
169169
return RBOOL(is_frozen_p());
170-
} else if(try_as<Symbol>(this)) {
170+
} else if(try_as<Symbol>(this) || try_as<Fixnum>(this)) {
171171
return cTrue;
172-
} else if(try_as<Fixnum>(this)) {
172+
} else if(this->nil_p() || this->true_p() || this->false_p()) {
173173
return cTrue;
174174
} else {
175175
LookupTable* tbl = try_as<LookupTable>(G(external_ivars)->fetch(state, this));

0 commit comments

Comments
 (0)