Skip to content
Permalink
Browse files
[Truffle] Implemented NilClass#dup.
  • Loading branch information
nirvdrum committed Dec 2, 2014
1 parent 96be43f commit 9e0af49366e29438e8e502fc0b567dc450d95fc9
Showing with 18 additions and 1 deletion.
  1. +18 −0 core/src/main/java/org/jruby/truffle/nodes/core/NilClassNodes.java
  2. +0 −1 spec/truffle/tags/core/nil/dup_tags.txt
@@ -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")
@@ -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 {

This file was deleted.

0 comments on commit 9e0af49

Please sign in to comment.