Skip to content

Commit

Permalink
[Truffle] Implemented NilClass#dup.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Dec 2, 2014
1 parent 96be43f commit 9e0af49
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 18 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/core/NilClassNodes.java
Expand Up @@ -12,6 +12,7 @@
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.*;

@CoreClass(name = "NilClass")
Expand Down Expand Up @@ -119,6 +120,23 @@ public RubyString toS() {
}
}

@CoreMethod(names = "dup", needsSelf = false)
public abstract static class DupNode extends CoreMethodNode {

public DupNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public DupNode(DupNode prev) {
super(prev);
}

@Specialization
public RubyString dup() {
throw new RaiseException(getContext().getCoreLibrary().typeError("can't dup NilClass", this));
}
}

@CoreMethod(names = "&", needsSelf = false, required = 1)
public abstract static class AndNode extends CoreMethodNode {

Expand Down
1 change: 0 additions & 1 deletion spec/truffle/tags/core/nil/dup_tags.txt

This file was deleted.

0 comments on commit 9e0af49

Please sign in to comment.