Don't bind/evaluate variable value if the name is just an underscore

This commit is contained in:
Deukhoofd 2018-11-21 17:25:12 +01:00
parent 4ab755d0d2
commit 68830a1676
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 4 additions and 0 deletions

View File

@ -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)

View File

@ -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);