Add warnings when variable types are unknown
This commit is contained in:
parent
7ee230e20c
commit
dbc7b4eb4f
|
@ -317,10 +317,13 @@ namespace Upsilon.Binder
|
||||||
var boundVariable = TryBindVariable(name, isLocal, boundExpression, e.CommentData);
|
var boundVariable = TryBindVariable(name, isLocal, boundExpression, e.CommentData);
|
||||||
if (boundVariable != null)
|
if (boundVariable != null)
|
||||||
{
|
{
|
||||||
|
if (boundVariable.Type == Type.Unknown)
|
||||||
|
{
|
||||||
|
_diagnostics.LogUnknownVariableType(boundVariable.Name, variableExpression.Span);
|
||||||
|
}
|
||||||
var variable = new BoundVariableSymbol(boundVariable, variableExpression.Span);
|
var variable = new BoundVariableSymbol(boundVariable, variableExpression.Span);
|
||||||
return new BoundVariableAssignment(variable, boundExpression, isLocal, e.Span);
|
return new BoundVariableAssignment(variable, boundExpression, isLocal, e.Span);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BoundExpressionStatement(new BoundLiteralExpression(new ScriptNull(), e.Span), 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)
|
foreach (var identifierToken in s.Identifiers)
|
||||||
{
|
{
|
||||||
var boundVariable = TryBindVariable(identifierToken.Name, isLocal, assignment, null);
|
var boundVariable = TryBindVariable(identifierToken.Name, isLocal, assignment, null);
|
||||||
|
if (boundVariable.Type == Type.Unknown)
|
||||||
|
{
|
||||||
|
_diagnostics.LogUnknownVariableType(boundVariable.Name, identifierToken.Span);
|
||||||
|
}
|
||||||
ls.Add(boundVariable);
|
ls.Add(boundVariable);
|
||||||
}
|
}
|
||||||
return new BoundMultiAssignmentStatement(ls.ToImmutableArray(), assignment, s.Span);
|
return new BoundMultiAssignmentStatement(ls.ToImmutableArray(), assignment, s.Span);
|
||||||
|
|
Loading…
Reference in New Issue