Don't reset scope when function is executed

This commit is contained in:
Deukhoofd 2018-12-09 17:50:09 +01:00
parent 875525b6be
commit beac043995
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 1 additions and 2 deletions

View File

@ -16,7 +16,7 @@ namespace Upsilon.Evaluator
{ {
internal class Evaluator : IDisposable internal class Evaluator : IDisposable
{ {
private Script _script; private readonly Script _script;
private Diagnostics _diagnostics; private Diagnostics _diagnostics;
private ScriptType _lastValue; private ScriptType _lastValue;
private ScriptType _returnValue; private ScriptType _returnValue;
@ -65,7 +65,6 @@ namespace Upsilon.Evaluator
public ScriptType Evaluate(BoundScript e, string functionName, object[] parameters) public ScriptType Evaluate(BoundScript e, string functionName, object[] parameters)
{ {
EvaluateNode(e.Statement);
if (!Scope.TryGet(functionName, out var statement) || statement.Type != Type.Function) if (!Scope.TryGet(functionName, out var statement) || statement.Type != Type.Function)
{ {
throw new ArgumentException(($"Function '{functionName}' could not be found")); throw new ArgumentException(($"Function '{functionName}' could not be found"));