Skip to content
Permalink
Browse files
[Truffle] Simplify Kernel#eql?.
* We can just inherit instead of having it as a clone with a single child node.
  • Loading branch information
eregon committed Nov 3, 2014
1 parent 55bafc8 commit 9f827b9789b21fbdfe19ffb283ac0221f8db6865
Showing 1 changed file with 1 addition and 11 deletions.
@@ -409,23 +409,13 @@ public Object dup(VirtualFrame frame, RubyObject self) {
}

@CoreMethod(names = "eql?", required = 1)
public abstract static class EqlNode extends CoreMethodNode {

@Child protected BasicObjectNodes.ReferenceEqualNode referenceEqualNode;

public abstract static class EqlNode extends BasicObjectNodes.ReferenceEqualNode {
public EqlNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
referenceEqualNode = BasicObjectNodesFactory.ReferenceEqualNodeFactory.create(context, sourceSection, new RubyNode[]{null, null});
}

public EqlNode(EqlNode prev) {
super(prev);
referenceEqualNode = prev.referenceEqualNode;
}

@Specialization
public boolean equal(VirtualFrame frame, Object a, Object b) {
return referenceEqualNode.executeEqual(frame, a, b);
}
}

0 comments on commit 9f827b9

Please sign in to comment.