Пример #1
0
 public CodegenExpression EventBeanWithCtxGet(
     CodegenExpression beanExpression,
     CodegenExpression ctxExpression,
     CodegenMethodScope parent,
     CodegenClassScope classScope)
 {
     return(_getter.EventBeanGetCodegen(beanExpression, parent, classScope));
 }
Пример #2
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;
        }