예제 #1
0
파일: codegen.cs 프로젝트: retahc/old-code
        internal override void Walk(EmitContext ec)
        {
            if (ec.Emitting)
            {
                Label skip_label = ec.DefineLabel();

                nd1st.Walk(ec);
                ec.EmitDup();
                LocalBuilder first = ec.EmitStoreTemp();
                ec.EmitBranchIfTrue(skip_label);

                nd2nd.Walk(ec);
                ec.EmitDup();
                LocalBuilder second = ec.EmitStoreTemp();
                ec.EmitBranchIfTrue(skip_label);

                ec.EmitLoadTemp(second);
                ec.EmitStoreTemp(first);

                ec.MarkLabel(skip_label);
                ec.EmitLoadTemp(first);
            }
            else
            {
                nd1st.Walk(ec);
                nd2nd.Walk(ec);
            }
        }
예제 #2
0
파일: codegen.cs 프로젝트: emtees/old-code
        internal override void Walk(EmitContext ec)
        {
            if(ec.Emitting) {
                Label skip_label = ec.DefineLabel();

                nd1st.Walk(ec);
                ec.EmitDup();
                LocalBuilder first = ec.EmitStoreTemp();
                ec.EmitBranchIfTrue(skip_label);
                
                nd2nd.Walk(ec);
                ec.EmitDup();
                LocalBuilder second = ec.EmitStoreTemp();
                ec.EmitBranchIfTrue(skip_label);
                
                ec.EmitLoadTemp(second);
                ec.EmitStoreTemp(first);
                
                ec.MarkLabel(skip_label);
                ec.EmitLoadTemp(first);
            } else {
                nd1st.Walk(ec);
                nd2nd.Walk(ec);
            }
        }