예제 #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 프로젝트: 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);
                }
            }
        }