Beispiel #1
0
        public static CodegenExpression CodegenWrapArray(
            ExprDotMethodForgeNoDuck forge,
            CodegenExpression inner,
            Type innerType,
            CodegenMethodScope codegenMethodScope,
            ExprForgeCodegenSymbol exprSymbol,
            CodegenClassScope codegenClassScope)
        {
            var methodNode = codegenMethodScope.MakeChild(
                    typeof(ICollection<object>),
                    typeof(ExprDotMethodForgeNoDuckEvalWrapArray),
                    codegenClassScope)
                .AddParam(innerType, "target");

            var returnType = forge.Method.ReturnType;
            methodNode.Block
                .DeclareVar(
                    returnType.GetBoxedType(),
                    "array",
                    CodegenPlain(forge, Ref("target"), innerType, methodNode, exprSymbol, codegenClassScope))
                .MethodReturn(
                    CollectionUtil.ArrayToCollectionAllowNullCodegen(
                        methodNode,
                        returnType,
                        Ref("array"),
                        codegenClassScope));
            return LocalMethod(methodNode, inner);
        }
Beispiel #2
0
 public CodegenExpression CodegenConvertNonNull(
     CodegenExpression result,
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return CollectionUtil.ArrayToCollectionAllowNullCodegen(
         codegenMethodScope,
         arrayType,
         result,
         codegenClassScope);
 }
 public static CodegenExpression Codegen(
     InnerDotArrPrimitiveToCollForge forge,
     CodegenMethodScope codegenMethodScope,
     ExprForgeCodegenSymbol exprSymbol,
     CodegenClassScope codegenClassScope)
 {
     Type evaluationType = forge.rootForge.EvaluationType;
     return CollectionUtil.ArrayToCollectionAllowNullCodegen(
         codegenMethodScope,
         evaluationType,
         forge.rootForge.EvaluateCodegen(evaluationType, codegenMethodScope, exprSymbol, codegenClassScope),
         codegenClassScope);
 }