private String GetCodegen(ICodegenContext context)
        {
            var mComponentType = context.MakeAddMember(typeof(Type), _componentType);
            var mParser        = context.MakeAddMember(typeof(SimpleTypeParser), _parser);

            return(context.AddMethod(typeof(object), typeof(object), "node", GetType())
                   .DeclareVar(typeof(object[]), "result", _getter.GetValueAsNodeArrayCodegen(Ref("node"), context))
                   .IfRefNullReturnNull("result")
                   .MethodReturn(
                       StaticMethod(
                           GetType(), "GetDOMArrayFromNodes",
                           Ref("result"),
                           Ref(mComponentType.MemberName),
                           Ref(mParser.MemberName))));
        }
Esempio n. 2
0
 private CodegenMethod GetCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     var mComponentType = codegenClassScope.AddDefaultFieldUnshared(true, typeof(Type), Constant(componentType));
     var mParser = codegenClassScope.AddOrGetDefaultFieldSharable(
         new SimpleTypeParserCodegenFieldSharable(parser, codegenClassScope));
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(XmlNode), "node")
         .Block
         .DeclareVar<XmlNode[]>(
             "result",
             getter.GetValueAsNodeArrayCodegen(Ref("node"), codegenMethodScope, codegenClassScope))
         .IfRefNullReturnNull("result")
         .MethodReturn(StaticMethod(GetType(), "GetDOMArrayFromNodes", Ref("result"), mComponentType, mParser));
 }