Show better error position if table assignment statement is a bad statement

This commit is contained in:
Deukhoofd 2019-01-21 18:56:32 +01:00
parent e5f08d5859
commit a413c5ecd4
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 5 additions and 3 deletions

View File

@ -911,7 +911,8 @@ namespace Upsilon.Binder
{
BoundExpression indexableExpression;
var value = BindExpression(e.Expression);
if (e.TableExpression.Kind == SyntaxKind.BadExpression)
return new BoundExpressionStatement(new BoundBadExpression(e.Span), e.Span);
if (e.TableExpression.Kind == SyntaxKind.IndexExpression)
{
@ -936,9 +937,10 @@ namespace Upsilon.Binder
}
else
{
var indexable =
(BoundFullStopIndexExpression) BindFullStopIndexExpression(
var indexableExp = BindFullStopIndexExpression(
(FullStopIndexExpressionSyntax) e.TableExpression, true);
if (!(indexableExp is BoundFullStopIndexExpression indexable))
return new BoundExpressionStatement(new BoundBadExpression(e.Span), e.Span);
if (indexable.Expression.Kind == BoundKind.VariableExpression)
{