Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }