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
97220b53
Commit
97220b53
authored
10 years ago
by
Lukas Stadler
Browse files
Options
Downloads
Patches
Plain Diff
error profile in Assign
parent
f2ad55df
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.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java
+8
-1
8 additions, 1 deletion
...n/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java
with
8 additions
and
1 deletion
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java
+
8
−
1
View file @
97220b53
...
...
@@ -56,6 +56,8 @@ public abstract class Assign extends RInvisibleBuiltinNode {
@CompilationFinal
private
String
lastName
;
@CompilationFinal
private
final
BranchProfile
[]
slotFoundOnIteration
=
{
BranchProfile
.
create
(),
BranchProfile
.
create
(),
BranchProfile
.
create
()};
private
final
BranchProfile
errorProfile
=
BranchProfile
.
create
();
private
final
BranchProfile
warningProfile
=
BranchProfile
.
create
();
private
final
BranchProfile
invalidateProfile
=
BranchProfile
.
create
();
private
void
ensureWrite
(
String
x
)
{
...
...
@@ -68,13 +70,15 @@ public abstract class Assign extends RInvisibleBuiltinNode {
}
}
private
String
checkVariable
(
RAbstractStringVector
xVec
)
throws
RError
{
private
String
checkVariable
(
RAbstractStringVector
xVec
)
{
int
len
=
xVec
.
getLength
();
if
(
len
==
1
)
{
return
xVec
.
getDataAt
(
0
);
}
else
if
(
len
==
0
)
{
errorProfile
.
enter
();
throw
RError
.
error
(
getEncapsulatingSourceSection
(),
RError
.
Message
.
INVALID_FIRST_ARGUMENT
);
}
else
{
warningProfile
.
enter
();
RContext
.
getInstance
().
setEvalWarning
(
"only the first element is used as variable name"
);
return
xVec
.
getDataAt
(
0
);
}
...
...
@@ -101,6 +105,7 @@ public abstract class Assign extends RInvisibleBuiltinNode {
REnvironment
.
globalEnv
().
put
(
x
,
value
);
}
}
catch
(
PutException
ex
)
{
errorProfile
.
enter
();
throw
RError
.
error
(
getEncapsulatingSourceSection
(),
ex
);
}
return
value
;
...
...
@@ -144,11 +149,13 @@ public abstract class Assign extends RInvisibleBuiltinNode {
String
x
=
checkVariable
(
xVec
);
controlVisibility
();
if
(
envir
==
REnvironment
.
emptyEnv
())
{
errorProfile
.
enter
();
throw
RError
.
error
(
getEncapsulatingSourceSection
(),
RError
.
Message
.
CANNOT_ASSIGN_IN_EMPTY_ENV
);
}
try
{
envir
.
put
(
x
,
value
);
}
catch
(
PutException
ex
)
{
errorProfile
.
enter
();
throw
RError
.
error
(
getEncapsulatingSourceSection
(),
ex
);
}
return
value
;
...
...
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