public static CodegenExpression Codegen( EnumDistinctEventsForge forge, EnumForgeCodegenParams args, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { var innerType = Boxing.GetBoxedType(forge.InnerExpression.EvaluationType); var scope = new ExprForgeCodegenSymbol(false, null); var methodNode = codegenMethodScope.MakeChildWithScope( typeof(FlexCollection), typeof(EnumDistinctEventsForgeEval), scope, codegenClassScope) .AddParam(EnumForgeCodegenNames.PARAMS); var block = methodNode.Block .IfCondition(Relational(ExprDotName(EnumForgeCodegenNames.REF_ENUMCOLL, "Count"), LE, Constant(1))) .BlockReturn(EnumForgeCodegenNames.REF_ENUMCOLL) .DeclareVar<IDictionary<object, EventBean>>("distinct", NewInstance(typeof(LinkedHashMap<object, EventBean>))); block.ForEach(typeof(EventBean), "next", EnumForgeCodegenNames.REF_ENUMCOLL) .AssignArrayElement(EnumForgeCodegenNames.REF_EPS, Constant(forge.StreamNumLambda), Ref("next")) .DeclareVar( innerType, "comparable", forge.InnerExpression.EvaluateCodegen(innerType, methodNode, scope, codegenClassScope)) .IfCondition(Not(ExprDotMethod(Ref("distinct"), "CheckedContainsKey", Ref("comparable")))) .Expression(ExprDotMethod(Ref("distinct"), "Put", Ref("comparable"), Ref("next"))) .BlockEnd(); block.MethodReturn(FlexWrap(ExprDotName(Ref("distinct"), "Values"))); return LocalMethod(methodNode, args.Eps, args.Enumcoll, args.IsNewData, args.ExprCtx); }
public EnumDistinctEventsForgeEval( EnumDistinctEventsForge forge, ExprEvaluator innerExpression) { _forge = forge; _innerExpression = innerExpression; }