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)
|
private VariableSymbol TryBindVariable(string name, bool isLocal, BoundExpression assignment)
|
||||||
{
|
{
|
||||||
|
if (name == "_")
|
||||||
|
return null;
|
||||||
if (!Scope.TryGetVariable(name, !isLocal, out var variable))
|
if (!Scope.TryGetVariable(name, !isLocal, out var variable))
|
||||||
{
|
{
|
||||||
if (assignment.Type == Type.Table)
|
if (assignment.Type == Type.Table)
|
||||||
|
|
|
@ -290,6 +290,8 @@ namespace Upsilon.Evaluator
|
||||||
var variableSymbol = e.Variables[i];
|
var variableSymbol = e.Variables[i];
|
||||||
if (variableSymbol == null)
|
if (variableSymbol == null)
|
||||||
continue;
|
continue;
|
||||||
|
if (variableSymbol.Name == "_")
|
||||||
|
continue;
|
||||||
var value = table.Get(_diagnostics, e.Span, new NumberLong(i + 1), Scope);
|
var value = table.Get(_diagnostics, e.Span, new NumberLong(i + 1), Scope);
|
||||||
if (variableSymbol.Local)
|
if (variableSymbol.Local)
|
||||||
Scope.Set(variableSymbol, value);
|
Scope.Set(variableSymbol, value);
|
||||||
|
|
Loading…
Reference in New Issue