diff --git a/Upsilon/Binder/Binder.cs b/Upsilon/Binder/Binder.cs index 66cc4fb..3fa205a 100644 --- a/Upsilon/Binder/Binder.cs +++ b/Upsilon/Binder/Binder.cs @@ -283,6 +283,13 @@ namespace Upsilon.Binder { return ((TableVariableSymbol)indexerVariable).Variables[fullStopIndexExpression.Index]; } + if (indexerVariable.Type == Type.UserData) + { + var bDefProperty = ((UserDataBoundTypeDefinition) ((FunctionParameterSymbol) indexerVariable) + .BoundTypeDefinition).Properties[fullStopIndexExpression.Index]; + var boundDef = BoundTypeHandler.GetTypeDefinition(bDefProperty.ActualType); + return new FunctionParameterSymbol(fullStopIndexExpression.Index, boundDef); + } } return null; } diff --git a/Upsilon/Parser/Parser.cs b/Upsilon/Parser/Parser.cs index 87f3882..4504581 100644 --- a/Upsilon/Parser/Parser.cs +++ b/Upsilon/Parser/Parser.cs @@ -495,13 +495,17 @@ namespace Upsilon.Parser private ExpressionSyntax ParseFullStopIndexExpression(ExpressionSyntax expression) { var fullStop = MatchToken(SyntaxKind.FullStop); - var index = MatchToken(SyntaxKind.Identifier); - if (index is IdentifierToken identifier) + if (Current.Kind == SyntaxKind.Identifier) { - return new FullStopIndexExpressionSyntax(expression, fullStop, identifier); + var index = NextToken(); + return new FullStopIndexExpressionSyntax(expression, fullStop, (IdentifierToken) index); + } _diagnostics.LogBadCharacter(expression.Span, SyntaxKind.Identifier); - return new BadExpressionSyntax(); + // We'll still want to return a index expression, but we just express that the identifier is empty. + // This is helpful for tools, etc + return new FullStopIndexExpressionSyntax(expression, fullStop, + new IdentifierToken(string.Empty, fullStop.Span.End)); } private ExpressionSyntax ParseParenthesizedExpression()