예제 #1
0
파일: codegen.cs 프로젝트: retahc/old-code
        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
파일: codegen.cs 프로젝트: retahc/old-code
        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
파일: codegen.cs 프로젝트: emtees/old-code
        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
파일: codegen.cs 프로젝트: emtees/old-code
 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);
     }
 }