示例#1
0
        internal override void Walk(EmitContext ec)
        {
            // Due to the slightly weird RNode inheritance hierarchy
            bool is_load = this is RNLVar || this is RNDVar;

            if (!(is_load || this is RNDAsgn || this is RNLAsgn))
            {
                throw new NotSupportedException("bug: variable type not supported: " + this.GetType().Name);
            }

            if (ec.Resolving)
            {
                v = ec.scope.MarkVariable(vid);
            }

            if (!is_load)
            {
                val.Walk(ec);
            }

            if (ec.Emitting)
            {
                if (is_load)
                {
                    Variable v = ec.scope.GetVariable(vid);
                    ec.EmitLoadVar(v);
                }
                else
                {
                    ec.EmitDup();
                    ec.EmitStoreVar(v);
                }
            }
        }
示例#2
0
        EmitScope scope; // New scope for the method

        internal static void WalkArg(EmitContext ec, int i, uint vid)
        {
            if (ec.Resolving)
            {
                Variable v = ec.scope.MarkVariable(vid);
                v.IsArgument = true;
            }
            // Move argument from array to locals, required due to the cache used
            if (ec.Emitting)
            {
                Variable v = ec.scope.GetVariable(vid);
                ec.EmitLoadArg(i);
                ec.EmitStoreVar(v);
            }
        }
示例#3
0
        internal override void Walk(EmitContext ec)
        {
            // Due to the slightly weird RNode inheritance hierarchy
            bool is_load = this is RNLVar || this is RNDVar;
            
            if(!(is_load || this is RNDAsgn || this is RNLAsgn)) {
                throw new NotSupportedException("bug: variable type not supported: " + this.GetType().Name);
            }

            if(ec.Resolving) {
                v = ec.scope.MarkVariable(vid);
            }

            if(!is_load)
                val.Walk(ec);
            
            if(ec.Emitting) {
                if(is_load) {
                    Variable v = ec.scope.GetVariable(vid);
                    ec.EmitLoadVar(v);
                } else {
                    ec.EmitDup();
                    ec.EmitStoreVar(v);
                }
            }
        }
示例#4
0
 EmitScope scope; // New scope for the method
 
 internal static void WalkArg(EmitContext ec, int i, uint vid)
 {
     if(ec.Resolving) {
         Variable v = ec.scope.MarkVariable(vid);
         v.IsArgument = true;
     }
     // Move argument from array to locals, required due to the cache used
     if(ec.Emitting) {
         Variable v = ec.scope.GetVariable(vid);
         ec.EmitLoadArg(i);
         ec.EmitStoreVar(v);
     }
 }