private void SetupGlobalScope() { this.globalScope = new RuntimeScope(null, -1); this.globalScope.AddVariables(this.globalVariables.ToArray()); this.globalScope.SetOperations(this.asm.GlobalInstructions); this.currentScope = globalScope; }
internal RuntimeScope(RuntimeScope parent, int depth) { this.parent = parent; this.depth = depth; variables = new Dictionary <string, RuntimeVariable>(); scopes = new List <RuntimeScope>(); operations = new List <Operation>(); }
private void RunToEnd() { this.interrupted = false; while (!this.interrupted && RunNextStep()) { } this.currentScope = null; this.globalScope.Position = 0; vm.SetRunningState(false); }
internal RuntimeScope BeginScope() { // we only have global and function scope right now, so to improve performance we will return the same scope // TODO: remove this control in the future when we introduce the use of deeper scopes //if (this.scopes.Count > 1) //{ // return this.scopes[this.scopes.Count - 1]; //} var s = new RuntimeScope(this, depth + 1); scopes.Add(s); return(s); }
internal void EndScope(object result = null) { this.lastScope = this.CurrentScope; this.currentScope = this.CurrentScope.EndScope(result); }
internal void BeginScope() { this.currentScope = this.CurrentScope.BeginScope(); }