Fix textspan of assignments

This commit is contained in:
Deukhoofd 2018-11-12 17:55:06 +01:00
parent 0d08ceda17
commit e5ac28bacf
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 4 additions and 1 deletions

View File

@ -1,8 +1,9 @@
using System.Collections.Generic;
using Upsilon.Text;
namespace Upsilon.Parser
{
public class AssignmentExpressionSyntax : StatementSyntax
public sealed class AssignmentExpressionSyntax : StatementSyntax
{
public AssignmentExpressionSyntax(SyntaxToken localToken, IdentifierToken identifier, SyntaxToken equalsToken,
ExpressionSyntax expression)
@ -11,6 +12,8 @@ namespace Upsilon.Parser
Identifier = identifier;
EqualsToken = equalsToken;
Expression = expression;
var start = LocalToken?.Span.Start ?? Identifier.Span.Start;
Span = new TextSpan(start, Expression.Span.End);
}
public override SyntaxKind Kind => SyntaxKind.AssignmentStatement;