From 68830a1676f68e6c4052d25a1e206b15533ebec9 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 21 Nov 2018 17:25:12 +0100 Subject: [PATCH] Don't bind/evaluate variable value if the name is just an underscore --- Upsilon/Binder/Binder.cs | 2 ++ Upsilon/Evaluator/Evaluator.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Upsilon/Binder/Binder.cs b/Upsilon/Binder/Binder.cs index 0c527c1..dc408c5 100644 --- a/Upsilon/Binder/Binder.cs +++ b/Upsilon/Binder/Binder.cs @@ -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) diff --git a/Upsilon/Evaluator/Evaluator.cs b/Upsilon/Evaluator/Evaluator.cs index c087a50..04c6a17 100644 --- a/Upsilon/Evaluator/Evaluator.cs +++ b/Upsilon/Evaluator/Evaluator.cs @@ -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);