diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java index 52efddcdd4fbd4c2a2eda5c01ba82ab1a0bf23ce..e27bad40806901ffc33bd5a8c0b0e417938dd88c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java @@ -22,16 +22,13 @@ import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.access.AccessSlotNode; import com.oracle.truffle.r.nodes.access.AccessSlotNodeGen; -import com.oracle.truffle.r.nodes.access.ConstantNode; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import com.oracle.truffle.r.nodes.function.WrapArgumentNode; import com.oracle.truffle.r.nodes.function.opt.UpdateShareableChildValueNode; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RPromise; -import com.oracle.truffle.r.runtime.data.RSymbol; -import com.oracle.truffle.r.runtime.nodes.RSyntaxLookup; +import com.oracle.truffle.r.runtime.data.RPromise.Closure; @RBuiltin(name = "@", kind = PRIMITIVE, parameterNames = {"", ""}, nonEvalArgs = 1, behavior = COMPLEX) public abstract class Slot extends RBuiltinNode.Arg2 { @@ -46,20 +43,12 @@ public abstract class Slot extends RBuiltinNode.Arg2 { private String getName(Object nameObj) { if (nameObj instanceof RPromise) { - Object rep = ((RPromise) nameObj).getRep(); - if (rep instanceof WrapArgumentNode) { - rep = ((WrapArgumentNode) rep).getOperand(); - } - if (rep instanceof ConstantNode) { - Object val = ((ConstantNode) rep).getValue(); - if (val instanceof String) { - return (String) val; - } - if (val instanceof RSymbol) { - return ((RSymbol) val).getName(); - } - } else if (rep instanceof RSyntaxLookup) { - return ((RSyntaxLookup) rep).getIdentifier(); + RPromise promise = (RPromise) nameObj; + Closure closure = promise.getClosure(); + if (closure.asStringConstant() != null) { + return closure.asStringConstant(); + } else if (closure.asSymbol() != null) { + return closure.asSymbol(); } } CompilerDirectives.transferToInterpreter();