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
6ace9245
Commit
6ace9245
authored
9 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
fix bug for length 0/1 blocks deparse
parent
e7388106
Branches
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/control/BlockNode.java
+11
-5
11 additions, 5 deletions
...des/src/com/oracle/truffle/r/nodes/control/BlockNode.java
with
11 additions
and
5 deletions
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/BlockNode.java
+
11
−
5
View file @
6ace9245
...
@@ -79,7 +79,8 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
...
@@ -79,7 +79,8 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
@Override
@Override
public
void
deparseImpl
(
RDeparse
.
State
state
)
{
public
void
deparseImpl
(
RDeparse
.
State
state
)
{
state
.
startNodeDeparse
(
this
);
state
.
startNodeDeparse
(
this
);
if
(
sequence
.
length
>
1
)
{
// empty deparses as {}
if
(
sequence
.
length
!=
1
)
{
state
.
writeOpenCurlyNLIncIndent
();
state
.
writeOpenCurlyNLIncIndent
();
}
}
for
(
int
i
=
0
;
i
<
sequence
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
sequence
.
length
;
i
++)
{
...
@@ -91,7 +92,7 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
...
@@ -91,7 +92,7 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
state
.
mark
();
// in case last
state
.
mark
();
// in case last
}
}
}
}
if
(
sequence
.
length
>
1
)
{
if
(
sequence
.
length
!=
1
)
{
state
.
decIndentWriteCloseCurly
();
state
.
decIndentWriteCloseCurly
();
}
}
state
.
endNodeDeparse
(
this
);
state
.
endNodeDeparse
(
this
);
...
@@ -138,10 +139,15 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
...
@@ -138,10 +139,15 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
/*
/*
* We can't get this completely compatible with GnuR without knowing if the source had a "{"
* We can't get this completely compatible with GnuR without knowing if the source had a "{"
* or not. However, semantically what really matters is that if the length is > 1, there
* or not. However, semantically what really matters is that if the length is > 1, there
* *must* have been a "{", so we fabricate it.
* *must* have been a "{", so we fabricate it. Furthermore, if length==1, then we must
* delegate to the underlying node
*/
*/
int
len
=
getSequence
().
length
;
int
len
=
getSequence
().
length
;
return
len
==
1
?
1
:
len
+
1
;
if
(
len
==
1
)
{
return
getSequence
()[
0
].
asRSyntaxNode
().
getRlengthImpl
();
}
else
{
return
len
+
1
;
}
}
}
@Override
@Override
...
@@ -156,7 +162,7 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
...
@@ -156,7 +162,7 @@ public class BlockNode extends SequenceNode implements RSyntaxNode, VisibilityCo
return
RASTUtils
.
createLanguageElement
(
seq
[
index
-
1
]);
return
RASTUtils
.
createLanguageElement
(
seq
[
index
-
1
]);
}
}
}
else
{
}
else
{
return
RASTUtils
.
createLanguageElement
(
seq
[
0
]
);
return
getSequence
()[
0
].
asRSyntaxNode
().
getRelementImpl
(
index
);
}
}
}
}
...
...
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