Skip to content

Commit

Permalink
[Truffle] Bignum do not have a singleton class.
Browse files Browse the repository at this point in the history
* Duplicating the logic of hasNoSingleton() in SingletonClassNode is not worth it.
  • Loading branch information
eregon committed Dec 29, 2014
1 parent 8e34ffa commit bf361f9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Expand Up @@ -62,12 +62,6 @@ protected Object singletonClass(double value) {
throw new RaiseException(getContext().getCoreLibrary().typeErrorCantDefineSingleton(this));
}

@Specialization
protected Object singletonClass(RubyBignum value) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeErrorCantDefineSingleton(this));
}

@Specialization
protected RubyClass singletonClass(RubyBasicObject object) {
return object.getSingletonClass(this);
Expand Down
Expand Up @@ -25,6 +25,11 @@ public RubyBignum(RubyClass rubyClass, BigInteger value) {
this.value = value;
}

@Override
public boolean hasNoSingleton() {
return true;
}

@CompilerDirectives.TruffleBoundary
public RubyBignum negate() {
return create(value.negate());
Expand Down

0 comments on commit bf361f9

Please sign in to comment.