From dd8569ecb0abb8379dbde69ba0311ae7a236c684 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 27 Nov 2018 17:40:54 +0100 Subject: [PATCH] Fixes diagnostics breaking when using ContinueWith function --- Upsilon/Evaluator/Script.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Upsilon/Evaluator/Script.cs b/Upsilon/Evaluator/Script.cs index 3a77812..a9e5a0b 100644 --- a/Upsilon/Evaluator/Script.cs +++ b/Upsilon/Evaluator/Script.cs @@ -41,9 +41,12 @@ namespace Upsilon.Evaluator private Script(string scriptString, Binder.Binder binder, Evaluator evaluator, ScriptOptions options) { ScriptString = new SourceText(scriptString); - Diagnostics = new Diagnostics(ScriptString, Options.ThrowExceptionOnError); - Binder = new Binder.Binder(Diagnostics, binder.Scope.Variables); - Evaluator = new Evaluator( Diagnostics, evaluator.Scope.Variables); + Options = options; + _scriptString = scriptString; + Diagnostics = new Diagnostics(ScriptString, options.ThrowExceptionOnError); + + Binder = Upsilon.Binder.Binder.CreateWithSetScope(Diagnostics, binder.Scope); + Evaluator = Evaluator.CreateWithSetScope(Diagnostics, evaluator.Scope); Scope = Evaluator.Scope; }