From 235cbbc22723656c3e6474eb4f5f76c9e1c1617a Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Sun, 15 Sep 2024 18:31:10 +0200 Subject: [PATCH] Add list expressions in for statement --- oscar64/Parser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/oscar64/Parser.cpp b/oscar64/Parser.cpp index b1f916c..a57d780 100644 --- a/oscar64/Parser.cpp +++ b/oscar64/Parser.cpp @@ -8978,6 +8978,7 @@ Expression* Parser::ParseListExpression(bool lhs) return ParseBinaryFoldExpression(nexp); nexp->mRight = ParseListExpression(false); + nexp->mDecType = nexp->mRight->mDecType; exp = nexp; } return exp; @@ -9259,7 +9260,7 @@ Expression* Parser::ParseStatement(void) // Assignment if (mScanner->mToken != TK_SEMICOLON) - initExp = CleanupExpression(ParseExpression(true)); + initExp = CleanupExpression(ParseListExpression(true)); if ((mCompilerOptions & COPT_CPLUSPLUS) && ConsumeTokenIf(TK_COLON)) { @@ -9445,7 +9446,7 @@ Expression* Parser::ParseStatement(void) // Condition if (mScanner->mToken != TK_SEMICOLON) - conditionExp = CoerceExpression(CleanupExpression(ParseExpression(false)), TheBoolTypeDeclaration); + conditionExp = CoerceExpression(CleanupExpression(ParseListExpression(false)), TheBoolTypeDeclaration); if (mScanner->mToken == TK_SEMICOLON) mScanner->NextToken(); @@ -9454,7 +9455,7 @@ Expression* Parser::ParseStatement(void) // Iteration if (mScanner->mToken != TK_CLOSE_PARENTHESIS) - iterateExp = CleanupExpression(ParseExpression(false)); + iterateExp = CleanupExpression(ParseListExpression(false)); } ConsumeToken(TK_CLOSE_PARENTHESIS);