Fix simple expressions not functioning

This commit is contained in:
Deukhoofd 2018-11-17 19:18:54 +01:00
parent 6a396d6368
commit b897adccf8
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 12 additions and 2 deletions

View File

@ -296,8 +296,18 @@ namespace Upsilon.Parser
{
if (!lastCommaFound)
break;
var parsed = ParseExpression();
arrBuilder.Add(parsed);
var parsed = ParseStatement();
SyntaxNode node;
if (parsed.Kind == SyntaxKind.ExpressionStatement)
node = ((ExpressionStatementSyntax) parsed).Expression;
else if (parsed.Kind == SyntaxKind.AssignmentStatement)
node = parsed;
else
{
//TODO Better error handling
throw new Exception();
}
arrBuilder.Add(node);
lastCommaFound = Current.Kind == SyntaxKind.Comma;
if (lastCommaFound) NextToken();