Don't bind/evaluate variable value if the name is just an underscore
This commit is contained in:
parent
4ab755d0d2
commit
68830a1676
@ -224,6 +224,8 @@ namespace Upsilon.Binder
|
||||
|
||||
private VariableSymbol TryBindVariable(string name, bool isLocal, BoundExpression assignment)
|
||||
{
|
||||
if (name == "_")
|
||||
return null;
|
||||
if (!Scope.TryGetVariable(name, !isLocal, out var variable))
|
||||
{
|
||||
if (assignment.Type == Type.Table)
|
||||
|
@ -290,6 +290,8 @@ namespace Upsilon.Evaluator
|
||||
var variableSymbol = e.Variables[i];
|
||||
if (variableSymbol == null)
|
||||
continue;
|
||||
if (variableSymbol.Name == "_")
|
||||
continue;
|
||||
var value = table.Get(_diagnostics, e.Span, new NumberLong(i + 1), Scope);
|
||||
if (variableSymbol.Local)
|
||||
Scope.Set(variableSymbol, value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user