@@ -1081,7 +1081,7 @@ private ConditionData condition() throws IOException {
1081
1081
1082
1082
if (mustMatchToken (Token .LP , "msg.no.paren.cond" , true )) data .lp = ts .tokenBeg ;
1083
1083
1084
- data .condition = expr ();
1084
+ data .condition = expr (false );
1085
1085
1086
1086
if (mustMatchToken (Token .RP , "msg.no.paren.after.cond" , true )) data .rp = ts .tokenBeg ;
1087
1087
@@ -1245,7 +1245,7 @@ private AstNode statementHelper() throws IOException {
1245
1245
return pn ;
1246
1246
default :
1247
1247
lineno = ts .lineno ;
1248
- pn = new ExpressionStatement (expr (), !insideFunction ());
1248
+ pn = new ExpressionStatement (expr (false ), !insideFunction ());
1249
1249
pn .setLineno (lineno );
1250
1250
break ;
1251
1251
}
@@ -1319,7 +1319,7 @@ private SwitchStatement switchStatement() throws IOException {
1319
1319
if (mustMatchToken (Token .LP , "msg.no.paren.switch" , true )) pn .setLp (ts .tokenBeg - pos );
1320
1320
pn .setLineno (ts .lineno );
1321
1321
1322
- AstNode discriminant = expr ();
1322
+ AstNode discriminant = expr (false );
1323
1323
pn .setExpression (discriminant );
1324
1324
enterSwitch (pn );
1325
1325
@@ -1343,7 +1343,7 @@ private SwitchStatement switchStatement() throws IOException {
1343
1343
break switchLoop ;
1344
1344
1345
1345
case Token .CASE :
1346
- caseExpression = expr ();
1346
+ caseExpression = expr (false );
1347
1347
mustMatchToken (Token .COLON , "msg.no.colon.case" , true );
1348
1348
break ;
1349
1349
@@ -1499,22 +1499,22 @@ private Loop forLoop() throws IOException {
1499
1499
isForIn = true ;
1500
1500
inPos = ts .tokenBeg - forPos ;
1501
1501
markDestructuring (init );
1502
- cond = expr (); // object over which we're iterating
1502
+ cond = expr (false ); // object over which we're iterating
1503
1503
} else if (compilerEnv .getLanguageVersion () >= Context .VERSION_ES6
1504
1504
&& matchToken (Token .NAME , true )
1505
1505
&& "of" .equals (ts .getString ())) {
1506
1506
isForOf = true ;
1507
1507
inPos = ts .tokenBeg - forPos ;
1508
1508
markDestructuring (init );
1509
- cond = expr (); // object over which we're iterating
1509
+ cond = expr (false ); // object over which we're iterating
1510
1510
} else { // ordinary for-loop
1511
1511
mustMatchToken (Token .SEMI , "msg.no.semi.for" , true );
1512
1512
if (peekToken () == Token .SEMI ) {
1513
1513
// no loop condition
1514
1514
cond = new EmptyExpression (ts .tokenBeg , 1 );
1515
1515
cond .setLineno (ts .lineno );
1516
1516
} else {
1517
- cond = expr ();
1517
+ cond = expr (false );
1518
1518
}
1519
1519
1520
1520
mustMatchToken (Token .SEMI , "msg.no.semi.for.cond" , true );
@@ -1523,7 +1523,7 @@ && matchToken(Token.NAME, true)
1523
1523
incr = new EmptyExpression (tmpPos , 1 );
1524
1524
incr .setLineno (ts .lineno );
1525
1525
} else {
1526
- incr = expr ();
1526
+ incr = expr (false );
1527
1527
}
1528
1528
}
1529
1529
@@ -1593,7 +1593,7 @@ private AstNode forLoopInit(int tt) throws IOException {
1593
1593
consumeToken ();
1594
1594
init = variables (tt , ts .tokenBeg , false );
1595
1595
} else {
1596
- init = expr ();
1596
+ init = expr (false );
1597
1597
}
1598
1598
return init ;
1599
1599
} finally {
@@ -1667,7 +1667,7 @@ private TryStatement tryStatement() throws IOException {
1667
1667
1668
1668
if (matchToken (Token .IF , true )) {
1669
1669
guardPos = ts .tokenBeg ;
1670
- catchCond = expr ();
1670
+ catchCond = expr (false );
1671
1671
} else {
1672
1672
sawDefaultCatch = true ;
1673
1673
}
@@ -1751,7 +1751,7 @@ private ThrowStatement throwStatement() throws IOException {
1751
1751
// see bug 256617
1752
1752
reportError ("msg.bad.throw.eol" );
1753
1753
}
1754
- AstNode expr = expr ();
1754
+ AstNode expr = expr (false );
1755
1755
ThrowStatement pn = new ThrowStatement (pos , expr );
1756
1756
pn .setLineno (lineno );
1757
1757
return pn ;
@@ -1853,7 +1853,7 @@ private WithStatement withStatement() throws IOException {
1853
1853
int lineno = ts .lineno , pos = ts .tokenBeg , lp = -1 , rp = -1 ;
1854
1854
if (mustMatchToken (Token .LP , "msg.no.paren.with" , true )) lp = ts .tokenBeg ;
1855
1855
1856
- AstNode obj = expr ();
1856
+ AstNode obj = expr (false );
1857
1857
1858
1858
if (mustMatchToken (Token .RP , "msg.no.paren.after.with" , true )) rp = ts .tokenBeg ;
1859
1859
@@ -1927,7 +1927,7 @@ private AstNode returnOrYield(int tt, boolean exprContext) throws IOException {
1927
1927
}
1928
1928
// fallthrough
1929
1929
default :
1930
- e = expr ();
1930
+ e = expr (false );
1931
1931
end = getNodeEnd (e );
1932
1932
}
1933
1933
@@ -2004,7 +2004,7 @@ private AstNode defaultXmlNamespace() throws IOException {
2004
2004
reportError ("msg.bad.namespace" );
2005
2005
}
2006
2006
2007
- AstNode e = expr ();
2007
+ AstNode e = expr (false );
2008
2008
UnaryExpression dxmln = new UnaryExpression (pos , getNodeEnd (e ) - pos );
2009
2009
dxmln .setOperator (Token .DEFAULTNAMESPACE );
2010
2010
dxmln .setOperand (e );
@@ -2046,7 +2046,7 @@ private AstNode nameOrLabel() throws IOException {
2046
2046
2047
2047
// set check for label and call down to primaryExpr
2048
2048
currentFlaggedToken |= TI_CHECK_LABEL ;
2049
- AstNode expr = expr ();
2049
+ AstNode expr = expr (false );
2050
2050
2051
2051
if (expr .getType () != Token .LABEL ) {
2052
2052
AstNode n = new ExpressionStatement (expr , !insideFunction ());
@@ -2061,7 +2061,7 @@ private AstNode nameOrLabel() throws IOException {
2061
2061
AstNode stmt = null ;
2062
2062
while (peekToken () == Token .NAME ) {
2063
2063
currentFlaggedToken |= TI_CHECK_LABEL ;
2064
- expr = expr ();
2064
+ expr = expr (false );
2065
2065
if (expr .getType () != Token .LABEL ) {
2066
2066
stmt = new ExpressionStatement (expr , !insideFunction ());
2067
2067
autoInsertSemicolon (stmt );
@@ -2203,7 +2203,7 @@ private AstNode let(boolean isStatement, int pos) throws IOException {
2203
2203
pn .setType (Token .LET );
2204
2204
} else {
2205
2205
// let expression
2206
- AstNode expr = expr ();
2206
+ AstNode expr = expr (false );
2207
2207
pn .setLength (getNodeEnd (expr ) - pos );
2208
2208
pn .setBody (expr );
2209
2209
if (isStatement ) {
@@ -2287,10 +2287,6 @@ else if (symDeclType == Token.LP) {
2287
2287
}
2288
2288
}
2289
2289
2290
- private AstNode expr () throws IOException {
2291
- return expr (false );
2292
- }
2293
-
2294
2290
private AstNode expr (boolean allowTrailingComma ) throws IOException {
2295
2291
AstNode pn = assignExpr ();
2296
2292
int pos = pn .getPosition ();
@@ -2641,7 +2637,7 @@ private AstNode xmlInitializer() throws IOException {
2641
2637
AstNode expr =
2642
2638
(peekToken () == Token .RC )
2643
2639
? new EmptyExpression (beg , ts .tokenEnd - beg )
2644
- : expr ();
2640
+ : expr (false );
2645
2641
mustMatchToken (Token .RC , "msg.syntax" , true );
2646
2642
XmlExpression xexpr = new XmlExpression (beg , expr );
2647
2643
xexpr .setIsXmlAttribute (ts .isXMLAttribute ());
@@ -2773,7 +2769,7 @@ private AstNode memberExprTail(boolean allowCallSyntax, AstNode pn) throws IOExc
2773
2769
lineno = ts .lineno ;
2774
2770
mustHaveXML ();
2775
2771
setRequiresActivation ();
2776
- AstNode filter = expr ();
2772
+ AstNode filter = expr (false );
2777
2773
int end = getNodeEnd (filter );
2778
2774
if (mustMatchToken (Token .RP , "msg.no.paren" , true )) {
2779
2775
rp = ts .tokenBeg ;
@@ -2792,7 +2788,7 @@ private AstNode memberExprTail(boolean allowCallSyntax, AstNode pn) throws IOExc
2792
2788
consumeToken ();
2793
2789
int lb = ts .tokenBeg , rb = -1 ;
2794
2790
lineno = ts .lineno ;
2795
- AstNode expr = expr ();
2791
+ AstNode expr = expr (false );
2796
2792
end = getNodeEnd (expr );
2797
2793
if (mustMatchToken (Token .RB , "msg.no.bracket.index" , true )) {
2798
2794
rb = ts .tokenBeg ;
@@ -3043,7 +3039,7 @@ private AstNode propertyName(int atPos, int memberTypeFlags) throws IOException
3043
3039
*/
3044
3040
private XmlElemRef xmlElemRef (int atPos , Name namespace , int colonPos ) throws IOException {
3045
3041
int lb = ts .tokenBeg , rb = -1 , pos = atPos != -1 ? atPos : lb ;
3046
- AstNode expr = expr ();
3042
+ AstNode expr = expr (false );
3047
3043
int end = getNodeEnd (expr );
3048
3044
if (mustMatchToken (Token .RB , "msg.no.bracket.index" , true )) {
3049
3045
rb = ts .tokenBeg ;
@@ -3366,7 +3362,7 @@ private ArrayComprehensionLoop arrayComprehensionLoop() throws IOException {
3366
3362
default :
3367
3363
reportError ("msg.in.after.for.name" );
3368
3364
}
3369
- AstNode obj = expr ();
3365
+ AstNode obj = expr (false );
3370
3366
if (mustMatchToken (Token .RP , "msg.no.paren.for.ctrl" , true )) rp = ts .tokenBeg - pos ;
3371
3367
3372
3368
pn .setLength (ts .tokenEnd - pos );
@@ -3451,7 +3447,7 @@ private GeneratorExpressionLoop generatorExpressionLoop() throws IOException {
3451
3447
}
3452
3448
3453
3449
if (mustMatchToken (Token .IN , "msg.in.after.for.name" , true )) inPos = ts .tokenBeg - pos ;
3454
- AstNode obj = expr ();
3450
+ AstNode obj = expr (false );
3455
3451
if (mustMatchToken (Token .RP , "msg.no.paren.for.ctrl" , true )) rp = ts .tokenBeg - pos ;
3456
3452
3457
3453
pn .setLength (ts .tokenEnd - pos );
@@ -3733,7 +3729,7 @@ private AstNode templateLiteral(boolean isTaggedLiteral) throws IOException {
3733
3729
int tt = ts .readTemplateLiteral (isTaggedLiteral );
3734
3730
while (tt == Token .TEMPLATE_LITERAL_SUBST ) {
3735
3731
elements .add (createTemplateLiteralCharacters (posChars ));
3736
- elements .add (expr ());
3732
+ elements .add (expr (false ));
3737
3733
mustMatchToken (Token .RC , "msg.syntax" , true );
3738
3734
posChars = ts .tokenBeg + 1 ;
3739
3735
tt = ts .readTemplateLiteral (isTaggedLiteral );
0 commit comments