Boo.Lang.Compiler.Steps.ProcessMethodBodies.BindNullableComparison C# (CSharp) Метод

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

private BindNullableComparison ( Boo.Lang.Compiler.Ast.BinaryExpression node ) : bool
node Boo.Lang.Compiler.Ast.BinaryExpression
Результат bool
        bool BindNullableComparison(BinaryExpression node)
        {
            if (!IsNullableOperation(node))
                return false;

            if (IsNull(node.Left) || IsNull(node.Right))
            {
                Expression nullable = IsNull(node.Left) ? node.Right : node.Left;
                Expression val = new MemberReferenceExpression(nullable, "HasValue");
                node.Replace(node.Left, val);
                Visit(val);
                Expression nil = new BoolLiteralExpression(false);
                node.Replace(node.Right, nil);
                Visit(nil);
                BindExpressionType(node, TypeSystemServices.BoolType);
                return true;
            }

            BinaryExpression valueCheck = new BinaryExpression(
                (node.Operator == BinaryOperatorType.Inequality)
                    ? BinaryOperatorType.BitwiseOr
                    : BinaryOperatorType.BitwiseAnd,
                new BinaryExpression(
                    GetCorrespondingHasValueOperator(node.Operator),
                    CreateNullableHasValueOrTrueExpression(node.Left),
                    CreateNullableHasValueOrTrueExpression(node.Right)
                ),
                new BinaryExpression(
                    node.Operator,
                    CreateNullableGetValueOrDefaultExpression(node.Left),
                    CreateNullableGetValueOrDefaultExpression(node.Right)
                )
            );
            node.ParentNode.Replace(node, valueCheck);
            Visit(valueCheck);
            return true;
        }
ProcessMethodBodies