Fix missing span in bad expression syntax

This commit is contained in:
Deukhoofd 2018-12-07 14:36:44 +01:00
parent 247ac10f17
commit c1da2dd5b7
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 8 additions and 2 deletions

View File

@ -1,9 +1,15 @@
using System.Collections.Generic;
using Upsilon.Text;
namespace Upsilon.Parser
{
public class BadExpressionSyntax : ExpressionSyntax
{
public BadExpressionSyntax(TextSpan span)
{
Span = span;
}
public override SyntaxKind Kind => SyntaxKind.BadExpression;
public override IEnumerable<SyntaxNode> ChildNodes()
{

View File

@ -352,7 +352,7 @@ namespace Upsilon.Parser
if (identifier.Kind != SyntaxKind.VariableExpression)
{
_diagnostics.LogError("Only identifiers can be used for a multi assignment statement.", identifier.Span);
return new ExpressionStatementSyntax(new BadExpressionSyntax());
return new ExpressionStatementSyntax(new BadExpressionSyntax(identifier.Span));
}
var cast = (VariableExpressionSyntax)identifier;
var ls = new List<IdentifierToken>(){cast.Identifier};
@ -445,7 +445,7 @@ namespace Upsilon.Parser
default:
_diagnostics.LogBadCharacter(new TextSpan(_position, 1));
NextToken();
expression = new BadExpressionSyntax();
expression = new BadExpressionSyntax(new TextSpan(_position, 1));
break;
}
return expression;