Don't reset scope when function is executed
This commit is contained in:
parent
875525b6be
commit
beac043995
|
@ -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"));
|
||||||
|
|
Loading…
Reference in New Issue