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; }