Boo.Lang.Compiler.Steps.EmitAssembly.EmitLogicalOperator C# (CSharp) Метод

EmitLogicalOperator() приватный Метод

private EmitLogicalOperator ( Boo.Lang.Compiler.Ast.BinaryExpression node, OpCode brForValueType, OpCode brForRefType ) : void
node Boo.Lang.Compiler.Ast.BinaryExpression
brForValueType OpCode
brForRefType OpCode
Результат void
        void EmitLogicalOperator(BinaryExpression node, OpCode brForValueType, OpCode brForRefType)
        {
            var type = GetExpressionType(node);
            Visit(node.Left);

            var lhsType = PopType();

            if (lhsType != null && lhsType.IsValueType && !type.IsValueType)
            {
                // if boxing, first evaluate the value
                // as it is and then box it...
                Label evalRhs = _il.DefineLabel();
                Label end = _il.DefineLabel();

                Dup();
                EmitToBoolIfNeeded(node.Left);	// may need to convert decimal to bool
                _il.Emit(brForValueType, evalRhs);
                EmitCastIfNeeded(type, lhsType);
                _il.Emit(OpCodes.Br_S, end);

                _il.MarkLabel(evalRhs);
                _il.Emit(OpCodes.Pop);
                LoadExpressionWithType(type, node.Right);

                _il.MarkLabel(end);
            }
            else
            {
                Label end = _il.DefineLabel();

                EmitCastIfNeeded(type, lhsType);
                Dup();

                EmitToBoolIfNeeded(node.Left);

                _il.Emit(brForRefType, end);

                _il.Emit(OpCodes.Pop);
                LoadExpressionWithType(type, node.Right);
                _il.MarkLabel(end);
            }

            PushType(type);
        }
EmitAssembly