예제 #1
0
        public static CodegenExpression CodegenExprEnumEval(
            ExprEnumerationGivenEventForge enumEval,
            CodegenMethod method,
            SAIFFInitializeSymbol symbols,
            CodegenClassScope classScope,
            Type generator)
        {
            //var evaluator = NewAnonymousClass(method.Block, typeof(ExprEnumerationGivenEvent));

            var enumSymbols = new ExprEnumerationGivenEventSymbol();

            var evaluateEventGetROCollectionEventsMethod = method
                .MakeChildWithScope(typeof(FlexCollection), generator, enumSymbols, classScope)
                .AddParam(typeof(EventBean), "@event")
                .AddParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT);
            evaluateEventGetROCollectionEventsMethod.Block.MethodReturn(
                enumEval.EvaluateEventGetROCollectionEventsCodegen(
                    evaluateEventGetROCollectionEventsMethod,
                    enumSymbols,
                    classScope));

            var evaluateEventGetROCollectionEvents = new CodegenExpressionLambda(method.Block)
                .WithParam(typeof(EventBean), "@event")
                .WithParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT)
                .WithBody(
                    block => {
                        block.DebugStack();
                        block.BlockReturn(
                            LocalMethod(
                                evaluateEventGetROCollectionEventsMethod,
                                Ref("@event"),
                                Ref(NAME_EXPREVALCONTEXT)));
                    });
                
            //var evaluateEventGetROCollectionEvents = CodegenMethod
            //    .MakeParentNode(typeof(ICollection<object>), generator, enumSymbols, classScope)
            //    .AddParam(typeof(EventBean), "@event")
            //    .AddParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT);
            //evaluator.AddMethod("EvaluateEventGetROCollectionEvents", evaluateEventGetROCollectionEvents);
            //
            //evaluateEventGetROCollectionEvents.Block.MethodReturn(
            //    enumEval.EvaluateEventGetROCollectionEventsCodegen(
            //        evaluateEventGetROCollectionEvents,
            //        enumSymbols,
            //        classScope));

            var evaluateEventGetROCollectionScalarMethod = method
                .MakeChildWithScope(typeof(FlexCollection), generator, enumSymbols, classScope)
                .AddParam(typeof(EventBean), "@event")
                .AddParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT);
            evaluateEventGetROCollectionScalarMethod.Block.MethodReturn(
                    enumEval.EvaluateEventGetROCollectionScalarCodegen(
                        evaluateEventGetROCollectionScalarMethod,
                        enumSymbols,
                        classScope));

            var evaluateEventGetROCollectionScalar = new CodegenExpressionLambda(method.Block)
                .WithParam(typeof(EventBean), "@event")
                .WithParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT)
                .WithBody(
                    block => {
                        block.DebugStack();
                        block.BlockReturn(
                            LocalMethod(
                                evaluateEventGetROCollectionScalarMethod,
                                Ref("@event"),
                                Ref(NAME_EXPREVALCONTEXT)));
                    });

            //var evaluateEventGetROCollectionScalar = CodegenMethod
            //    .MakeParentNode(typeof(ICollection<object>), generator, enumSymbols, classScope)
            //    .AddParam(typeof(EventBean), "@event")
            //    .AddParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT);
            //evaluator.AddMethod("EvaluateEventGetROCollectionScalar", evaluateEventGetROCollectionScalar);
            //
            //evaluateEventGetROCollectionScalar.Block.MethodReturn(
            //    enumEval.EvaluateEventGetROCollectionScalarCodegen(
            //        evaluateEventGetROCollectionScalar,
            //        enumSymbols,
            //        classScope));

            var evaluateEventGetEventBeanMethod = method
                .MakeChildWithScope(typeof(EventBean), generator, enumSymbols, classScope)
                .AddParam(typeof(EventBean), "@event")
                .AddParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT);
            evaluateEventGetEventBeanMethod.Block.MethodReturn(
                enumEval.EvaluateEventGetEventBeanCodegen(
                    evaluateEventGetEventBeanMethod, 
                    enumSymbols, 
                    classScope));
            
            var evaluateEventGetEventBean = new CodegenExpressionLambda(method.Block)
                .WithParam(typeof(EventBean), "@event")
                .WithParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT)
                .WithBody(
                    block => {
                        block.DebugStack();
                        block.BlockReturn(
                            LocalMethod(
                                evaluateEventGetEventBeanMethod,
                                Ref("@event"),
                                Ref(NAME_EXPREVALCONTEXT)));
                    });

            //var evaluateEventGetEventBean = CodegenMethod
            //    .MakeParentNode(typeof(EventBean), generator, enumSymbols, classScope)
            //    .AddParam(typeof(EventBean), "@event")
            //    .AddParam(typeof(ExprEvaluatorContext), NAME_EXPREVALCONTEXT);
            //evaluator.AddMethod("EvaluateEventGetEventBean", evaluateEventGetEventBean);
            //
            //evaluateEventGetEventBean.Block.MethodReturn(
            //    enumEval.EvaluateEventGetEventBeanCodegen(
            //        evaluateEventGetEventBean, 
            //        enumSymbols, 
            //        classScope));

            var evaluator = NewInstance<ProxyExprEnumerationGivenEvent>(
                evaluateEventGetROCollectionEvents,
                evaluateEventGetROCollectionScalar,
                evaluateEventGetEventBean);

            return evaluator;
        }