@@ -1233,7 +1233,7 @@ private DMASTProcStatement For() {
12331233 if ( Check ( TokenType . DM_RightParenthesis ) ) {
12341234 ExtraColonPeriod ( ) ;
12351235
1236- return new DMASTProcStatementInfLoop ( loc , GetForBody ( loc ) ) ;
1236+ return new DMASTProcStatementInfLoop ( loc , GetForBody ( ) ) ;
12371237 }
12381238
12391239 _allowVarDeclExpression = true ;
@@ -1255,7 +1255,7 @@ private DMASTProcStatement For() {
12551255 Consume ( TokenType . DM_RightParenthesis , "Expected ')' in for after to expression" ) ;
12561256 ExtraColonPeriod ( ) ;
12571257
1258- return new DMASTProcStatementFor ( loc , new DMASTExpressionInRange ( loc , assign . LHS , assign . RHS , endRange , step ) , null , null , dmTypes , GetForBody ( loc ) ) ;
1258+ return new DMASTProcStatementFor ( loc , new DMASTExpressionInRange ( loc , assign . LHS , assign . RHS , endRange , step ) , null , null , dmTypes , GetForBody ( ) ) ;
12591259 } else {
12601260 Emit ( WarningCode . BadExpression , "Expected = before to in for" ) ;
12611261 return new DMASTInvalidProcStatement ( loc ) ;
@@ -1269,20 +1269,20 @@ private DMASTProcStatement For() {
12691269 Consume ( TokenType . DM_RightParenthesis , "Expected ')' in for after expression 2" ) ;
12701270 ExtraColonPeriod ( ) ;
12711271
1272- return new DMASTProcStatementFor ( loc , new DMASTExpressionIn ( loc , expr1 , listExpr ) , null , null , dmTypes , GetForBody ( loc ) ) ;
1272+ return new DMASTProcStatementFor ( loc , new DMASTExpressionIn ( loc , expr1 , listExpr ) , null , null , dmTypes , GetForBody ( ) ) ;
12731273 }
12741274
12751275 if ( ! Check ( ForSeparatorTypes ) ) {
12761276 Consume ( TokenType . DM_RightParenthesis , "Expected ')' in for after expression 1" ) ;
12771277 ExtraColonPeriod ( ) ;
12781278
1279- return new DMASTProcStatementFor ( loc , expr1 , null , null , dmTypes , GetForBody ( loc ) ) ;
1279+ return new DMASTProcStatementFor ( loc , expr1 , null , null , dmTypes , GetForBody ( ) ) ;
12801280 }
12811281
12821282 if ( Check ( TokenType . DM_RightParenthesis ) ) {
12831283 ExtraColonPeriod ( ) ;
12841284
1285- return new DMASTProcStatementFor ( loc , expr1 , null , null , dmTypes , GetForBody ( loc ) ) ;
1285+ return new DMASTProcStatementFor ( loc , expr1 , null , null , dmTypes , GetForBody ( ) ) ;
12861286 }
12871287
12881288 Whitespace ( ) ;
@@ -1299,13 +1299,13 @@ private DMASTProcStatement For() {
12991299 Consume ( TokenType . DM_RightParenthesis , "Expected ')' in for after expression 2" ) ;
13001300 ExtraColonPeriod ( ) ;
13011301
1302- return new DMASTProcStatementFor ( loc , expr1 , expr2 , null , dmTypes , GetForBody ( loc ) ) ;
1302+ return new DMASTProcStatementFor ( loc , expr1 , expr2 , null , dmTypes , GetForBody ( ) ) ;
13031303 }
13041304
13051305 if ( Check ( TokenType . DM_RightParenthesis ) ) {
13061306 ExtraColonPeriod ( ) ;
13071307
1308- return new DMASTProcStatementFor ( loc , expr1 , expr2 , null , dmTypes , GetForBody ( loc ) ) ;
1308+ return new DMASTProcStatementFor ( loc , expr1 , expr2 , null , dmTypes , GetForBody ( ) ) ;
13091309 }
13101310
13111311 Whitespace ( ) ;
@@ -1321,30 +1321,19 @@ private DMASTProcStatement For() {
13211321 Consume ( TokenType . DM_RightParenthesis , "Expected ')' in for after expression 3" ) ;
13221322 ExtraColonPeriod ( ) ;
13231323
1324- return new DMASTProcStatementFor ( loc , expr1 , expr2 , expr3 , dmTypes , GetForBody ( loc ) ) ;
1324+ return new DMASTProcStatementFor ( loc , expr1 , expr2 , expr3 , dmTypes , GetForBody ( ) ) ;
13251325
1326- DMASTProcBlockInner GetForBody ( Location forLocation ) {
1326+ DMASTProcBlockInner GetForBody ( ) {
13271327 Whitespace ( ) ;
1328- Newline ( ) ;
13291328
13301329 DMASTProcBlockInner ? body = ProcBlock ( ) ;
1331- if ( body == null ) {
1332- var loc = Current ( ) . Location ;
1333- DMASTProcStatement ? statement ;
1334- if ( Check ( TokenType . DM_Semicolon ) ) {
1335- statement = new DMASTProcStatementExpression ( loc , new DMASTConstantNull ( loc ) ) ;
1336- } else {
1337- statement = ProcStatement ( ) ;
1338- if ( statement == null ) {
1339- Compiler . Emit ( WarningCode . MissingBody , forLocation , "Expected body or statement" ) ;
1340- statement = new DMASTInvalidProcStatement ( loc ) ;
1341- }
1342- }
1343-
1344- body = new DMASTProcBlockInner ( loc , statement ) ;
1345- }
1330+ if ( body != null )
1331+ return body ;
13461332
1347- return body ;
1333+ var statement = ProcStatement ( ) ;
1334+ return statement != null
1335+ ? new DMASTProcBlockInner ( loc , statement )
1336+ : new DMASTProcBlockInner ( CurrentLoc ) ;
13481337 }
13491338 }
13501339
0 commit comments