From c1da2dd5b7db6a9ead2e2328b7282f7c4a44bea8 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 7 Dec 2018 14:36:44 +0100 Subject: [PATCH] Fix missing span in bad expression syntax --- Upsilon/Parser/ExpressionSyntax/BadExpressionSyntax.cs | 6 ++++++ Upsilon/Parser/Parser.cs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Upsilon/Parser/ExpressionSyntax/BadExpressionSyntax.cs b/Upsilon/Parser/ExpressionSyntax/BadExpressionSyntax.cs index ead605e..f2fd32a 100644 --- a/Upsilon/Parser/ExpressionSyntax/BadExpressionSyntax.cs +++ b/Upsilon/Parser/ExpressionSyntax/BadExpressionSyntax.cs @@ -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 ChildNodes() { diff --git a/Upsilon/Parser/Parser.cs b/Upsilon/Parser/Parser.cs index 6f92282..2b640ba 100644 --- a/Upsilon/Parser/Parser.cs +++ b/Upsilon/Parser/Parser.cs @@ -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(){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;