Skip to content
Snippets Groups Projects
Commit a8110360 authored by Florian Angerer's avatar Florian Angerer
Browse files

Casting int sequence to string sequence in CastStringNode.

parent 88f8b42a
Branches
No related tags found
No related merge requests found
...@@ -33,7 +33,9 @@ import com.oracle.truffle.r.runtime.RDeparse; ...@@ -33,7 +33,9 @@ import com.oracle.truffle.r.runtime.RDeparse;
import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError;
import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RRuntime;
import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RDataFactory;
import com.oracle.truffle.r.runtime.data.RIntSequence;
import com.oracle.truffle.r.runtime.data.RLanguage; import com.oracle.truffle.r.runtime.data.RLanguage;
import com.oracle.truffle.r.runtime.data.RStringSequence;
import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.RStringVector;
import com.oracle.truffle.r.runtime.data.RSymbol; import com.oracle.truffle.r.runtime.data.RSymbol;
import com.oracle.truffle.r.runtime.data.model.RAbstractContainer; import com.oracle.truffle.r.runtime.data.model.RAbstractContainer;
...@@ -70,12 +72,21 @@ public abstract class CastStringNode extends CastStringBaseNode { ...@@ -70,12 +72,21 @@ public abstract class CastStringNode extends CastStringBaseNode {
return ret; return ret;
} }
protected boolean isIntSequence(RAbstractContainer c) {
return c instanceof RIntSequence;
}
@Specialization @Specialization
protected RStringVector doStringVector(RStringVector vector) { protected RStringVector doStringVector(RStringVector vector) {
return vector; return vector;
} }
@Specialization @Specialization
protected RStringSequence doStringVector(RIntSequence vector) {
return RDataFactory.createStringSequence("", "", vector.getStart(), vector.getStride(), vector.getLength());
}
@Specialization(guards = "!isIntSequence(operandIn)")
protected RStringVector doAbstractContainer(RAbstractContainer operandIn, protected RStringVector doAbstractContainer(RAbstractContainer operandIn,
@Cached("createClassProfile()") ValueProfile operandProfile, @Cached("createClassProfile()") ValueProfile operandProfile,
@Cached("createBinaryProfile()") ConditionProfile isLanguageProfile) { @Cached("createBinaryProfile()") ConditionProfile isLanguageProfile) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment