public CodegenExpression CodegenPremade( Type evaluationType, CodegenExpression input, Type inputType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { if (inputType.CanNotBeNull() || inputType.IsNumeric()) { return(numericTypeCaster.Codegen(input, inputType, codegenMethodScope, codegenClassScope)); } var methodNode = codegenMethodScope .MakeChild(evaluationType, typeof(NumberCasterComputer), codegenClassScope) .AddParam(inputType, "input"); methodNode.Block .IfInstanceOf("input", typeof(object)) .BlockReturn( numericTypeCaster.Codegen( CodegenExpressionBuilder.Ref("input"), inputType, methodNode, codegenClassScope)) .MethodReturn(CodegenExpressionBuilder.ConstantNull()); return(CodegenExpressionBuilder.LocalMethod(methodNode, input)); }
public CodegenExpression CodegenPremade( Type evaluationType, CodegenExpression input, Type inputType, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { return(caster.Codegen(input, inputType, codegenMethodScope, codegenClassScope)); }
private CodegenMethod GetCodegen( CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) { var cache = codegenClassScope.AddOrGetDefaultFieldSharable( new VariantPropertyGetterCacheCodegenField(variantEventType)); var method = codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope) .AddParam(typeof(EventBean), "eventBean"); method.Block .DeclareVar<object>( "value", StaticMethod( typeof(VariantEventPropertyGetterAny), "VariantGet", Ref("eventBean"), cache, Constant(propertyName))) .MethodReturn(caster.Codegen(Ref("value"), typeof(object), method, codegenClassScope)); return method; }