示例#1
0
 private CodegenMethod GetObjectArrayCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(object[]), "array")
         .Block
         .DeclareVar<object>("value", ArrayAtIndex(Ref("array"), Constant(propertyIndex)))
         .IfRefNullReturnNull("value")
         .IfInstanceOf("value", typeof(EventBean))
         .BlockReturn(
             entryGetter.EventBeanGetCodegen(
                 CastRef(typeof(EventBean), "value"),
                 codegenMethodScope,
                 codegenClassScope))
         .MethodReturn(
             entryGetter.UnderlyingGetCodegen(
                 FlexCast(entryGetter.TargetType, Ref("value")),
                 codegenMethodScope,
                 codegenClassScope));
 }
示例#2
0
 private CodegenMethod GetMapCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope
         .MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(IDictionary<string, object>), "map")
         .Block
         .DeclareVar<object>("value", ExprDotMethod(Ref("map"), "Get", Constant(propertyMap)))
         .IfRefNullReturnNull("value")
         .IfInstanceOf("value", typeof(EventBean))
         .BlockReturn(
             mapEntryGetter.EventBeanGetCodegen(
                 CastRef(typeof(EventBean), "value"),
                 codegenMethodScope,
                 codegenClassScope))
         .MethodReturn(
             mapEntryGetter.UnderlyingGetCodegen(
                 CastRef(mapEntryGetter.TargetType, "value"),
                 codegenMethodScope,
                 codegenClassScope));
 }