Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark nil/true/false as frozen
Browse files Browse the repository at this point in the history
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
Yorick Peterse committed Jul 24, 2015
1 parent 6370559 commit 6580956
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vm/builtin/object.cpp
Original file line number Diff line number Diff line change
@@ -167,9 +167,9 @@ namespace rubinius {
Object* Object::frozen_p(STATE) {
if(reference_p()) {
return RBOOL(is_frozen_p());
} else if(try_as<Symbol>(this)) {
} else if(try_as<Symbol>(this) || try_as<Fixnum>(this)) {
return cTrue;
} else if(try_as<Fixnum>(this)) {
} else if(this->nil_p() || this->true_p() || this->false_p()) {
return cTrue;
} else {
LookupTable* tbl = try_as<LookupTable>(G(external_ivars)->fetch(state, this));

0 comments on commit 6580956

Please sign in to comment.