Skip to content
Snippets Groups Projects
Commit 8abab034 authored by Adam Welc's avatar Adam Welc
Browse files

Simplified parameter cast to use freshly added abstract vector check.

parent 80e2bd26
Branches
No related tags found
No related merge requests found
...@@ -49,7 +49,6 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractComplexVector; ...@@ -49,7 +49,6 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractComplexVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractContainer; import com.oracle.truffle.r.runtime.data.model.RAbstractContainer;
import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector; import com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractListVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector; import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector; import com.oracle.truffle.r.runtime.data.model.RAbstractRawVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
...@@ -85,7 +84,7 @@ public abstract class Array extends RBuiltinNode { ...@@ -85,7 +84,7 @@ public abstract class Array extends RBuiltinNode {
@Override @Override
protected void createCasts(CastBuilder casts) { protected void createCasts(CastBuilder casts) {
Function<Object, Object> argType = this::argType; Function<Object, Object> argType = this::argType;
casts.arg("data").mustBe(instanceOf(RAbstractListVector.class).or(numericValue()).or(stringValue()).or(complexValue().or(rawValue())), casts.arg("data").mustBe(abstractVectorValue(),
RError.SHOW_CALLER, RError.Message.MUST_BE_VECTOR_BUT_WAS, "data", RError.SHOW_CALLER, RError.Message.MUST_BE_VECTOR_BUT_WAS, "data",
argType); argType);
casts.arg("dim").asIntegerVector().mustBe(notEmpty(), RError.SHOW_CALLER, RError.Message.CANNOT_BE_LENGTH, "dims", 0); casts.arg("dim").asIntegerVector().mustBe(notEmpty(), RError.SHOW_CALLER, RError.Message.CANNOT_BE_LENGTH, "dims", 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment