public static CodegenExpression Codegen(
                RectangleIntersectsRectangleForge forge,
                CodegenMethodScope codegenMethodScope,
                ExprForgeCodegenSymbol exprSymbol,
                CodegenClassScope codegenClassScope)
            {
                var methodNode = codegenMethodScope.MakeChild(
                    typeof(bool?),
                    typeof(RectangleIntersectsRectangleEvaluator),
                    codegenClassScope);

                var block = methodNode.Block;
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "meX",
                    forge.meXEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "meY",
                    forge.meYEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "meWidth",
                    forge.meWidthEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "meHeight",
                    forge.meHeightEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "otherX",
                    forge.otherXEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "otherY",
                    forge.otherYEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "otherWidth",
                    forge.otherWidthEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "otherHeight",
                    forge.otherHeightEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                block.MethodReturn(
                    StaticMethod(
                        typeof(BoundingBox),
                        "IntersectsBoxIncludingEnd",
                        Ref("meX"),
                        Ref("meY"),
                        Op(Ref("meX"), "+", Ref("meWidth")),
                        Op(Ref("meY"), "+", Ref("meHeight")),
                        Ref("otherX"),
                        Ref("otherY"),
                        Ref("otherWidth"),
                        Ref("otherHeight")));
                return LocalMethod(methodNode);
            }
コード例 #2
0
            public static CodegenExpression Codegen(
                PointIntersectsRectangleForge forge,
                CodegenMethodScope codegenMethodScope,
                ExprForgeCodegenSymbol exprSymbol,
                CodegenClassScope codegenClassScope)
            {
                CodegenMethod methodNode = codegenMethodScope.MakeChild(
                    typeof(bool?),
                    typeof(SettingsApplicationDotMethodRectangeIntersectsRectangle.RectangleIntersectsRectangleEvaluator
                           ),
                    codegenClassScope);

                CodegenBlock block = methodNode.Block;

                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "px",
                    forge.pxEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "py",
                    forge.pyEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "x",
                    forge.xEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "y",
                    forge.yEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "width",
                    forge.widthEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                CodegenLegoCast.AsDoubleNullReturnNull(
                    block,
                    "height",
                    forge.heightEval,
                    methodNode,
                    exprSymbol,
                    codegenClassScope);
                block.MethodReturn(
                    CodegenExpressionBuilder.StaticMethod(
                        typeof(BoundingBox),
                        "ContainsPoint",
                        CodegenExpressionBuilder.Ref("x"),
                        CodegenExpressionBuilder.Ref("y"),
                        CodegenExpressionBuilder.Ref("width"),
                        CodegenExpressionBuilder.Ref("height"),
                        CodegenExpressionBuilder.Ref("px"),
                        CodegenExpressionBuilder.Ref("py")));
                return(CodegenExpressionBuilder.LocalMethod(methodNode));
            }