| ... | @@ -1214,7 +1214,7 @@ static AstNode *ast_parse_ass_expr(ParseContext *pc, int *token_index, bool mand | ... | @@ -1214,7 +1214,7 @@ static AstNode *ast_parse_ass_expr(ParseContext *pc, int *token_index, bool mand |
| 1214 | } | 1214 | } |
| 1215 | | 1215 | |
| 1216 | /* | 1216 | /* |
| 1217 | NonBlockExpression : ReturnExpression | VariableDeclaration | AssignmentExpression | 1217 | NonBlockExpression : ReturnExpression | AssignmentExpression |
| 1218 | */ | 1218 | */ |
| 1219 | static AstNode *ast_parse_non_block_expr(ParseContext *pc, int *token_index, bool mandatory) { | 1219 | static AstNode *ast_parse_non_block_expr(ParseContext *pc, int *token_index, bool mandatory) { |
| 1220 | Token *token = &pc->tokens->at(*token_index); | 1220 | Token *token = &pc->tokens->at(*token_index); |
| ... | @@ -1223,11 +1223,6 @@ static AstNode *ast_parse_non_block_expr(ParseContext *pc, int *token_index, boo | ... | @@ -1223,11 +1223,6 @@ static AstNode *ast_parse_non_block_expr(ParseContext *pc, int *token_index, boo |
| 1223 | if (return_expr) | 1223 | if (return_expr) |
| 1224 | return return_expr; | 1224 | return return_expr; |
| 1225 | | 1225 | |
| 1226 | AstNode *variable_declaration_expr = ast_parse_variable_declaration_expr(pc, token_index, false); | | |
| 1227 | if (variable_declaration_expr) | | |
| 1228 | return variable_declaration_expr; | | |
| 1229 | | | |
| 1230 | | | |
| 1231 | AstNode *ass_expr = ast_parse_ass_expr(pc, token_index, false); | 1226 | AstNode *ass_expr = ast_parse_ass_expr(pc, token_index, false); |
| 1232 | if (ass_expr) | 1227 | if (ass_expr) |
| 1233 | return ass_expr; | 1228 | return ass_expr; |
| ... | @@ -1288,8 +1283,8 @@ static AstNode *ast_parse_label(ParseContext *pc, int *token_index, bool mandato | ... | @@ -1288,8 +1283,8 @@ static AstNode *ast_parse_label(ParseContext *pc, int *token_index, bool mandato |
| 1288 | } | 1283 | } |
| 1289 | | 1284 | |
| 1290 | /* | 1285 | /* |
| 1291 | Statement : Label | NonBlockExpression token(Semicolon) | BlockExpression | | |
| 1292 | Block : token(LBrace) list(option(Statement), token(Semicolon)) token(RBrace) | 1286 | Block : token(LBrace) list(option(Statement), token(Semicolon)) token(RBrace) |
| | 1287 | Statement : Label | VariableDeclaration token(Semicolon) | NonBlockExpression token(Semicolon) | BlockExpression |
| 1293 | */ | 1288 | */ |
| 1294 | static AstNode *ast_parse_block(ParseContext *pc, int *token_index, bool mandatory) { | 1289 | static AstNode *ast_parse_block(ParseContext *pc, int *token_index, bool mandatory) { |
| 1295 | Token *last_token = &pc->tokens->at(*token_index); | 1290 | Token *last_token = &pc->tokens->at(*token_index); |
| ... | @@ -1316,12 +1311,17 @@ static AstNode *ast_parse_block(ParseContext *pc, int *token_index, bool mandato | ... | @@ -1316,12 +1311,17 @@ static AstNode *ast_parse_block(ParseContext *pc, int *token_index, bool mandato |
| 1316 | if (statement_node) { | 1311 | if (statement_node) { |
| 1317 | semicolon_expected = false; | 1312 | semicolon_expected = false; |
| 1318 | } else { | 1313 | } else { |
| 1319 | statement_node = ast_parse_block_expr(pc, token_index, false); | 1314 | statement_node = ast_parse_variable_declaration_expr(pc, token_index, false); |
| 1320 | semicolon_expected = !statement_node; | 1315 | if (statement_node) { |
| 1321 | if (!statement_node) { | 1316 | semicolon_expected = true; |
| 1322 | statement_node = ast_parse_non_block_expr(pc, token_index, false); | 1317 | } else { |
| | 1318 | statement_node = ast_parse_block_expr(pc, token_index, false); |
| | 1319 | semicolon_expected = !statement_node; |
| 1323 | if (!statement_node) { | 1320 | if (!statement_node) { |
| 1324 | statement_node = ast_create_node(pc, NodeTypeVoid, last_token); | 1321 | statement_node = ast_parse_non_block_expr(pc, token_index, false); |
| | 1322 | if (!statement_node) { |
| | 1323 | statement_node = ast_create_node(pc, NodeTypeVoid, last_token); |
| | 1324 | } |
| 1325 | } | 1325 | } |
| 1326 | } | 1326 | } |
| 1327 | } | 1327 | } |