Fixed exception on adding variable to table of which we dont know the context
This commit is contained in:
parent
229fe3bffa
commit
2327e18f77
|
@ -804,9 +804,13 @@ namespace Upsilon.Binder
|
||||||
{
|
{
|
||||||
var variable = (BoundVariableExpression)indexable.Identifier;
|
var variable = (BoundVariableExpression)indexable.Identifier;
|
||||||
var index = (BoundLiteralExpression)indexable.Index;
|
var index = (BoundLiteralExpression)indexable.Index;
|
||||||
((TableVariableSymbol)variable.Variable.VariableSymbol).Variables.Add(index.Value.ToString(),
|
var variableSymbol = variable.Variable.VariableSymbol;
|
||||||
|
if (variableSymbol is TableVariableSymbol tableVariableSymbol)
|
||||||
|
{
|
||||||
|
tableVariableSymbol.Variables.Add(index.Value.ToString(),
|
||||||
new VariableSymbol(index.Value.ToString(), value.Type, false));
|
new VariableSymbol(index.Value.ToString(), value.Type, false));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
indexableExpression = indexable;
|
indexableExpression = indexable;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue