Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
ad3677a8
Commit
ad3677a8
authored
7 years ago
by
stepan
Browse files
Options
Downloads
Patches
Plain Diff
PositionsCheckNode: handle more types
parent
bb2d1fdc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/PositionCastNode.java
+9
-14
9 additions, 14 deletions
...racle/truffle/r/nodes/access/vector/PositionCastNode.java
with
9 additions
and
14 deletions
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/PositionCastNode.java
+
9
−
14
View file @
ad3677a8
...
...
@@ -23,6 +23,7 @@
package
com.oracle.truffle.r.nodes.access.vector
;
import
com.oracle.truffle.api.dsl.Cached
;
import
com.oracle.truffle.api.dsl.Fallback
;
import
com.oracle.truffle.api.dsl.Specialization
;
import
com.oracle.truffle.r.nodes.binary.BoxPrimitiveNode
;
import
com.oracle.truffle.r.nodes.unary.CastIntegerNode
;
...
...
@@ -37,10 +38,13 @@ import com.oracle.truffle.r.runtime.data.RInteger;
import
com.oracle.truffle.r.runtime.data.RLogical
;
import
com.oracle.truffle.r.runtime.data.RMissing
;
import
com.oracle.truffle.r.runtime.data.RNull
;
import
com.oracle.truffle.r.runtime.data.RObject
;
import
com.oracle.truffle.r.runtime.data.RS4Object
;
import
com.oracle.truffle.r.runtime.data.RString
;
import
com.oracle.truffle.r.runtime.data.RSymbol
;
import
com.oracle.truffle.r.runtime.data.RTypedValue
;
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.RAbstractDoubleVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractIntVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractListVector
;
...
...
@@ -170,23 +174,14 @@ abstract class PositionCastNode extends RBaseNode {
return
RDataFactory
.
createEmptyIntVector
();
}
@
Specialization
(
guards
=
"getInvalidType(position) != null"
)
@
Fallback
protected
RAbstractVector
doInvalidType
(
Object
position
)
{
throw
error
(
RError
.
Message
.
INVALID_SUBSCRIPT_TYPE
,
getInvalidType
(
position
).
getName
());
RType
type
=
getInvalidType
(
position
);
String
name
=
type
==
null
?
"unknown"
:
type
.
getName
();
throw
error
(
RError
.
Message
.
INVALID_SUBSCRIPT_TYPE
,
name
);
}
protected
static
RType
getInvalidType
(
Object
positionValue
)
{
if
(
positionValue
instanceof
RAbstractRawVector
)
{
return
RType
.
Raw
;
}
else
if
(
positionValue
instanceof
RAbstractListVector
)
{
return
RType
.
List
;
}
else
if
(
positionValue
instanceof
RFunction
)
{
return
RType
.
Closure
;
}
else
if
(
positionValue
instanceof
REnvironment
)
{
return
RType
.
Environment
;
}
else
if
(
positionValue
instanceof
RAbstractComplexVector
)
{
return
RType
.
Complex
;
}
return
null
;
return
positionValue
instanceof
RTypedValue
?
((
RTypedValue
)
positionValue
).
getRType
()
:
null
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment