Fix missing span in bad expression syntax
This commit is contained in:
parent
247ac10f17
commit
c1da2dd5b7
|
@ -1,9 +1,15 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Upsilon.Text;
|
||||||
|
|
||||||
namespace Upsilon.Parser
|
namespace Upsilon.Parser
|
||||||
{
|
{
|
||||||
public class BadExpressionSyntax : ExpressionSyntax
|
public class BadExpressionSyntax : ExpressionSyntax
|
||||||
{
|
{
|
||||||
|
public BadExpressionSyntax(TextSpan span)
|
||||||
|
{
|
||||||
|
Span = span;
|
||||||
|
}
|
||||||
|
|
||||||
public override SyntaxKind Kind => SyntaxKind.BadExpression;
|
public override SyntaxKind Kind => SyntaxKind.BadExpression;
|
||||||
public override IEnumerable<SyntaxNode> ChildNodes()
|
public override IEnumerable<SyntaxNode> ChildNodes()
|
||||||
{
|
{
|
||||||
|
|
|
@ -352,7 +352,7 @@ namespace Upsilon.Parser
|
||||||
if (identifier.Kind != SyntaxKind.VariableExpression)
|
if (identifier.Kind != SyntaxKind.VariableExpression)
|
||||||
{
|
{
|
||||||
_diagnostics.LogError("Only identifiers can be used for a multi assignment statement.", identifier.Span);
|
_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 cast = (VariableExpressionSyntax)identifier;
|
||||||
var ls = new List<IdentifierToken>(){cast.Identifier};
|
var ls = new List<IdentifierToken>(){cast.Identifier};
|
||||||
|
@ -445,7 +445,7 @@ namespace Upsilon.Parser
|
||||||
default:
|
default:
|
||||||
_diagnostics.LogBadCharacter(new TextSpan(_position, 1));
|
_diagnostics.LogBadCharacter(new TextSpan(_position, 1));
|
||||||
NextToken();
|
NextToken();
|
||||||
expression = new BadExpressionSyntax();
|
expression = new BadExpressionSyntax(new TextSpan(_position, 1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return expression;
|
return expression;
|
||||||
|
|
Loading…
Reference in New Issue