Skip to content
Snippets Groups Projects
Commit c8afa9d7 authored by Mick Jordan's avatar Mick Jordan
Browse files

serialize/quote fixes for ..n variables

parent d9fc2e21
Branches
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ public abstract class Quote extends RBuiltinNode { ...@@ -39,6 +39,7 @@ public abstract class Quote extends RBuiltinNode {
public abstract Object execute(VirtualFrame frame, RPromise expr); public abstract Object execute(VirtualFrame frame, RPromise expr);
private final ConditionProfile rvn = ConditionProfile.createBinaryProfile(); private final ConditionProfile rvn = ConditionProfile.createBinaryProfile();
private final ConditionProfile rvcn = ConditionProfile.createBinaryProfile();
private final ConditionProfile cn = ConditionProfile.createBinaryProfile(); private final ConditionProfile cn = ConditionProfile.createBinaryProfile();
@Specialization @Specialization
...@@ -57,6 +58,8 @@ public abstract class Quote extends RBuiltinNode { ...@@ -57,6 +58,8 @@ public abstract class Quote extends RBuiltinNode {
} else if (cn.profile(unode instanceof ConstantNode)) { } else if (cn.profile(unode instanceof ConstantNode)) {
ConstantNode cnode = (ConstantNode) unode; ConstantNode cnode = (ConstantNode) unode;
return cnode.getValue(); return cnode.getValue();
} else if (rvcn.profile(unode instanceof ReadVariadicComponentNode)) {
return RASTUtils.createRSymbol(unode);
} else { } else {
return RDataFactory.createLanguage(unode); return RDataFactory.createLanguage(unode);
} }
......
...@@ -106,11 +106,17 @@ public class RASTUtils { ...@@ -106,11 +106,17 @@ public class RASTUtils {
} }
/** /**
* Creates an {@link RSymbol} from a {@link ReadVariableNode}. * Creates an {@link RSymbol} from a {@link ReadVariableNode} o
* {@link ReadVariadicComponentNode}.
*/ */
@TruffleBoundary @TruffleBoundary
public static RSymbol createRSymbol(Node readVariableNode) { public static RSymbol createRSymbol(Node readVariableNode) {
return RDataFactory.createSymbol(((ReadVariableNode) readVariableNode).getIdentifier()); if (readVariableNode instanceof ReadVariadicComponentNode) {
ReadVariadicComponentNode rvcn = (ReadVariadicComponentNode) readVariableNode;
return RDataFactory.createSymbol(rvcn.getPrintForm());
} else {
return RDataFactory.createSymbol(((ReadVariableNode) readVariableNode).getIdentifier());
}
} }
/** /**
......
...@@ -84,11 +84,14 @@ public class ReadVariadicComponentNode extends RNode implements RSyntaxNode { ...@@ -84,11 +84,14 @@ public class ReadVariadicComponentNode extends RNode implements RSyntaxNode {
return ret == null ? RMissing.instance : ret; return ret == null ? RMissing.instance : ret;
} }
public String getPrintForm() {
return ".." + Integer.toString(index + 1);
}
@Override @Override
public void deparseImpl(State state) { public void deparseImpl(State state) {
state.startNodeDeparse(this); state.startNodeDeparse(this);
state.append(".."); state.append(getPrintForm());
state.append(Integer.toString(index + 1));
state.endNodeDeparse(this); state.endNodeDeparse(this);
} }
...@@ -97,6 +100,6 @@ public class ReadVariadicComponentNode extends RNode implements RSyntaxNode { ...@@ -97,6 +100,6 @@ public class ReadVariadicComponentNode extends RNode implements RSyntaxNode {
} }
public void serializeImpl(com.oracle.truffle.r.runtime.RSerialize.State state) { public void serializeImpl(com.oracle.truffle.r.runtime.RSerialize.State state) {
throw RInternalError.unimplemented(); state.setCarAsSymbol(getPrintForm());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment