From dbc7b4eb4f9afe34dc758bb1f545616b19d71923 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 28 Nov 2018 12:11:09 +0100 Subject: [PATCH] Add warnings when variable types are unknown --- Upsilon/Binder/Binder.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Upsilon/Binder/Binder.cs b/Upsilon/Binder/Binder.cs index 1e4950b..c5772d0 100644 --- a/Upsilon/Binder/Binder.cs +++ b/Upsilon/Binder/Binder.cs @@ -317,10 +317,13 @@ namespace Upsilon.Binder var boundVariable = TryBindVariable(name, isLocal, boundExpression, e.CommentData); if (boundVariable != null) { + if (boundVariable.Type == Type.Unknown) + { + _diagnostics.LogUnknownVariableType(boundVariable.Name, variableExpression.Span); + } var variable = new BoundVariableSymbol(boundVariable, variableExpression.Span); return new BoundVariableAssignment(variable, boundExpression, isLocal, e.Span); } - } return new BoundExpressionStatement(new BoundLiteralExpression(new ScriptNull(), e.Span), e.Span); @@ -335,6 +338,10 @@ namespace Upsilon.Binder foreach (var identifierToken in s.Identifiers) { var boundVariable = TryBindVariable(identifierToken.Name, isLocal, assignment, null); + if (boundVariable.Type == Type.Unknown) + { + _diagnostics.LogUnknownVariableType(boundVariable.Name, identifierToken.Span); + } ls.Add(boundVariable); } return new BoundMultiAssignmentStatement(ls.ToImmutableArray(), assignment, s.Span);