public override Expression GenCode(RHC rhc, ObjExpr objx, GenContext context) { Type targetType = _targetType; Type stubType = Compiler.CompileStubOrigClassVar.isBound ? (Type)Compiler.CompileStubOrigClassVar.deref() : null; if (_targetType == stubType) { targetType = objx.BaseType; } Expression target = _target.GenCode(RHC.Expression, objx, context); Expression call; if (targetType != null && _tinfo != null) { Expression convTarget = Expression.Convert(target, targetType); Expression access = GenAccess(rhc, objx, convTarget); call = HostExpr.GenBoxReturn(access, FieldType, objx, context); } else { // TODO: Convert to Dynamic call site call = Expression.Call(Compiler.Method_Reflector_GetInstanceFieldOrProperty, target, Expression.Constant(_fieldName)); } call = Compiler.MaybeAddDebugInfo(call, _spanMap, context.IsDebuggable); return(call); }
public override Expression GenCode(RHC rhc, ObjExpr objx, GenContext context) { Expression call; Type retType; if (_method != null) { call = GenDlrForMethod(objx, context); retType = _method.ReturnType; } else { call = GenerateComplexCall(objx, context); retType = typeof(object); } call = HostExpr.GenBoxReturn(call, retType, objx, context); call = Compiler.MaybeAddDebugInfo(call, _spanMap, context.IsDebuggable); return(call); }
public override Expression GenCode(RHC rhc, ObjExpr objx, GenContext context) { return(HostExpr.GenBoxReturn(GenCodeUnboxed(rhc, objx, context), FieldType, objx, context)); }
public Expression GenCode(RHC rhc, ObjExpr objx, GenContext context) { return(HostExpr.GenBoxReturn(GenCodeUnboxed(RHC.Expression, objx, context), typeof(bool), objx, context)); }