示例#1
0
 private void SetupGlobalScope()
 {
     this.globalScope = new RuntimeScope(null, -1);
     this.globalScope.AddVariables(this.globalVariables.ToArray());
     this.globalScope.SetOperations(this.asm.GlobalInstructions);
     this.currentScope = globalScope;
 }
示例#2
0
 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>();
 }
示例#3
0
        private void RunToEnd()
        {
            this.interrupted = false;
            while (!this.interrupted && RunNextStep())
            {
            }

            this.currentScope         = null;
            this.globalScope.Position = 0;

            vm.SetRunningState(false);
        }
示例#4
0
        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);
        }
示例#5
0
 internal void EndScope(object result = null)
 {
     this.lastScope    = this.CurrentScope;
     this.currentScope = this.CurrentScope.EndScope(result);
 }
示例#6
0
 internal void BeginScope()
 {
     this.currentScope = this.CurrentScope.BeginScope();
 }