Esempio n. 1
0
 private CodegenMethod GetCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(GenericRecord), "record")
         .Block
         .DeclareVar<GenericRecord>(
             "inner",
             CodegenExpressionBuilder.Cast(
                 typeof(GenericRecord),
                 CodegenExpressionBuilder.StaticMethod(
                     typeof(GenericRecordExtensions),
                     "Get",
                     CodegenExpressionBuilder.Ref("record"),
                     CodegenExpressionBuilder.Constant(_fieldTop))))
         .MethodReturn(
             CodegenExpressionBuilder.Conditional(
                 CodegenExpressionBuilder.EqualsNull(CodegenExpressionBuilder.Ref("inner")),
                 CodegenExpressionBuilder.ConstantNull(),
                 _getter.UnderlyingGetCodegen(
                     CodegenExpressionBuilder.Ref("inner"),
                     codegenMethodScope,
                     codegenClassScope)));
 }