Exemple #1
0
 public override CodegenMethod MakeCodegen(
     CodegenMethodScope parent,
     SAIFFInitializeSymbolWEventType symbols,
     CodegenClassScope classScope)
 {
     var method = parent.MakeChild(
         typeof(FilterSpecLookupableAdvancedIndex),
         typeof(FilterSpecLookupableAdvancedIndexForge),
         classScope);
     Func<EventPropertyGetterSPI, CodegenExpression> toEval = getter =>
         EventTypeUtility.CodegenGetterWCoerce(getter, typeof(double?), null, method, GetType(), classScope);
     method.Block
         .DeclareVar<FilterSpecLookupableAdvancedIndex>(
             "lookupable",
             NewInstance<FilterSpecLookupableAdvancedIndex>(
                 Constant(Expression),
                 ConstantNull(),
                 Typeof(ReturnType)))
         .SetProperty(Ref("lookupable"), "QuadTreeConfig", QuadTreeConfig.Make())
         .SetProperty(Ref("lookupable"), "X", toEval.Invoke(_x))
         .SetProperty(Ref("lookupable"), "Y", toEval.Invoke(_y))
         .SetProperty(Ref("lookupable"), "Width", toEval.Invoke(_width))
         .SetProperty(Ref("lookupable"), "Height", toEval.Invoke(_height))
         .SetProperty(Ref("lookupable"), "IndexType", Constant(IndexType))
         .Expression(
             ExprDotMethodChain(symbols.GetAddInitSvc(method))
                 .Get(EPStatementInitServicesConstants.FILTERSHAREDLOOKUPABLEREGISTERY)
                 .Add(
                     "RegisterLookupable",
                     symbols.GetAddEventType(method),
                     Ref("lookupable")))
         .MethodReturn(Ref("lookupable"));
     return method;
 }
Exemple #2
0
        public virtual CodegenMethod MakeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbolWEventType symbols,
            CodegenClassScope classScope)
        {
            var method = parent.MakeChild(
                typeof(ExprFilterSpecLookupable),
                typeof(ExprFilterSpecLookupableForge),
                classScope);
            CodegenExpression singleEventEvalExpr = ConstantNull();
            if (_optionalEventEvalForge != null) {
                var eval = new CodegenExpressionLambda(method.Block)
                    .WithParam<EventBean>("bean")
                    .WithParam<ExprEvaluatorContext>("ctx");
                var anonymous = NewInstance<ProxyExprEventEvaluator>(eval);
                eval.Block.BlockReturn(
                    _optionalEventEvalForge.EventBeanWithCtxGet(Ref("bean"), Ref("ctx"), method, classScope));
                singleEventEvalExpr = anonymous;
            }

            CodegenExpression epsEvalExpr = ConstantNull();
            if (_optionalExprForge != null) {
                epsEvalExpr = ExprNodeUtilityCodegen.CodegenEvaluator(
                    _optionalExprForge, method, typeof(ExprFilterSpecLookupableForge), classScope);
            }

            CodegenExpression serdeExpr = _valueSerde == null ? ConstantNull() : _valueSerde.Codegen(method, classScope, null);
            CodegenExpression returnTypeExpr = _returnType == null ? ConstantNull() : Typeof(_returnType);

            method.Block
                .DeclareVar<ExprEventEvaluator>("eval", singleEventEvalExpr)
                .DeclareVar<ExprEvaluator>("expr", epsEvalExpr)
                .DeclareVar<ExprFilterSpecLookupable>(
                    "lookupable",
                    NewInstance<ExprFilterSpecLookupable>(
                        Constant(_expression),
                        Ref("eval"),
                        Ref("expr"),
                        returnTypeExpr,
                        Constant(_isNonPropertyGetter),
                        serdeExpr))
                .Expression(
                    ExprDotMethodChain(symbols.GetAddInitSvc(method))
                        .Get(EPStatementInitServicesConstants.FILTERSHAREDLOOKUPABLEREGISTERY)
                        .Add(
                            "RegisterLookupable",
                            symbols.GetAddEventType(method),
                            Ref("lookupable")))
                .MethodReturn(Ref("lookupable"));
            return method;
        }
Exemple #3
0
        public virtual CodegenMethod MakeCodegen(
            CodegenMethodScope parent,
            SAIFFInitializeSymbolWEventType symbols,
            CodegenClassScope classScope)
        {
            var method = parent.MakeChild(
                typeof(ExprFilterSpecLookupable),
                typeof(ExprFilterSpecLookupableForge),
                classScope);
            CodegenExpression getterExpr;
            if (optionalEventPropForge != null) {
                var get = new CodegenExpressionLambda(method.Block)
                    .WithParams(CodegenNamedParam.From(typeof(EventBean), "bean"));
                var anonymous = NewInstance<ProxyEventPropertyValueGetter>(get);

                //var anonymous = NewAnonymousClass(method.Block, typeof(EventPropertyValueGetter));
                //var get = CodegenMethod.MakeParentNode(typeof(object), GetType(), classScope)
                //    .AddParam(CodegenNamedParam.From(typeof(EventBean), "bean"));
                //anonymous.AddMethod("Get", get);

                get.Block.BlockReturn(optionalEventPropForge.EventBeanGetCodegen(Ref("bean"), method, classScope));
                getterExpr = anonymous;
            }
            else {
                getterExpr = ConstantNull();
            }

            method.Block.DeclareVar<EventPropertyValueGetter>("getter", getterExpr);

            method.Block
                .DeclareVar<ExprFilterSpecLookupable>(
                    "lookupable",
                    NewInstance<ExprFilterSpecLookupable>(
                        Constant(expression),
                        Ref("getter"),
                        Typeof(returnType),
                        Constant(isNonPropertyGetter)))
                .Expression(
                    ExprDotMethodChain(symbols.GetAddInitSvc(method))
                        .Get(EPStatementInitServicesConstants.FILTERSHAREDLOOKUPABLEREGISTERY)
                        .Add(
                            "RegisterLookupable",
                            symbols.GetAddEventType(method),
                            Ref("lookupable")))
                .MethodReturn(Ref("lookupable"));
            return method;
        }