コード例 #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);
                }
            }
        }