public static CodegenExpression Codegen( ExprDotNodeForgeRootChild forge, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { var innerType = forge.innerForge.TypeInfo.GetCodegenReturnType().GetBoxedType(); var evaluationType = forge.EvaluationType.GetBoxedType(); var methodNode = codegenMethodScope.MakeChild( evaluationType, typeof(ExprDotNodeForgeRootChildEval), codegenClassScope); var innerValue = forge.innerForge.CodegenEvaluate(methodNode, exprSymbol, codegenClassScope); if (innerType == typeof(FlexCollection)) { innerValue = FlexWrap(innerValue); } var block = methodNode.Block.DeclareVar(innerType, "inner", innerValue); if (innerType.CanBeNull() && evaluationType != typeof(void)) { block.IfRefNullReturnNull("inner"); } var typeInformation = ConstantNull(); if (codegenClassScope.IsInstrumented) { typeInformation = codegenClassScope.AddOrGetDefaultFieldSharable( new EPTypeCodegenSharable(forge.innerForge.TypeInfo, codegenClassScope)); } block.Apply( InstrumentationCode.Instblock( codegenClassScope, "qExprDotChain", typeInformation, Ref("inner"), Constant(forge.forgesUnpacking.Length))); var expression = ExprDotNodeUtility.EvaluateChainCodegen( methodNode, exprSymbol, codegenClassScope, Ref("inner"), innerType, forge.forgesUnpacking, null); if (evaluationType == typeof(void)) { block.Expression(expression) .Apply(InstrumentationCode.Instblock(codegenClassScope, "aExprDotChain")) .MethodEnd(); } else { block.DeclareVar(evaluationType, "result", expression) .Apply(InstrumentationCode.Instblock(codegenClassScope, "aExprDotChain")) .MethodReturn(Ref("result")); } return LocalMethod(methodNode); }
public ExprDotNodeForgeRootChildEval( ExprDotNodeForgeRootChild forge, ExprDotEvalRootChildInnerEval innerEvaluator, ExprDotEval[] evalIteratorEventBean, ExprDotEval[] evalUnpacking) { this.forge = forge; this.innerEvaluator = innerEvaluator; this.evalIteratorEventBean = evalIteratorEventBean; this.evalUnpacking = evalUnpacking; }
public static CodegenExpression CodegenEvaluateGetROCollectionScalar( ExprDotNodeForgeRootChild forge, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { var methodNode = codegenMethodScope.MakeChild( forge.EvaluationType, typeof(ExprDotNodeForgeRootChildEval), codegenClassScope); var typeInformation = ConstantNull(); if (codegenClassScope.IsInstrumented) { typeInformation = codegenClassScope.AddOrGetDefaultFieldSharable( new EPTypeCodegenSharable(forge.innerForge.TypeInfo, codegenClassScope)); } methodNode.Block .DeclareVar<FlexCollection>( "inner", forge.innerForge.EvaluateGetROCollectionScalarCodegen( methodNode, exprSymbol, codegenClassScope)) .Apply( InstrumentationCode.Instblock( codegenClassScope, "qExprDotChain", typeInformation, Ref("inner"), Constant(forge.forgesUnpacking.Length))) .IfRefNull("inner") .Apply(InstrumentationCode.Instblock(codegenClassScope, "aExprDotChain")) .BlockReturn(ConstantNull()) .DeclareVar( forge.EvaluationType, "result", ExprDotNodeUtility.EvaluateChainCodegen( methodNode, exprSymbol, codegenClassScope, Ref("inner"), typeof(ICollection<object>), forge.forgesIteratorEventBean, null)) .Apply(InstrumentationCode.Instblock(codegenClassScope, "aExprDotChain")) .MethodReturn(Ref("result")); return LocalMethod(methodNode); }