public MakeCallExpression ( Microsoft.Scripting.Actions.Calls.OverloadResolverFactory resolverFactory, |
||
resolverFactory | Microsoft.Scripting.Actions.Calls.OverloadResolverFactory | |
method | ||
return |
internal override Expression GetBoundValue(ActionBinder binder, Type type, Expression instance) { if (instance == null) { return(null); } if (GetIndexParameters().Length > 0) { // need to bind to a value or parameters to get the value. return(binder.ReturnMemberTracker(type, BindToInstance(instance))); } MethodInfo getter = ResolveGetter(); if (getter == null || getter.ContainsGenericParameters) { // no usable getter return(null); } if (getter.IsPublic && getter.DeclaringType.IsPublic) { return(binder.MakeCallExpression(getter, instance));; } // private binding is just a call to the getter method... return(MemberTracker.FromMemberInfo(getter).Call(binder, instance)); }
protected internal override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) { if (instance != null && IsStatic) { return(null); } if (GetIndexParameters().Length > 0) { // need to bind to a value or parameters to get the value. return(binder.ReturnMemberTracker(type, BindToInstance(instance))); } MethodInfo getter = ResolveGetter(binder.PrivateBinding); if (getter == null || getter.ContainsGenericParameters) { // no usable getter return(null); } if (getter.IsPublic && getter.DeclaringType.IsVisible) { return(binder.MakeCallExpression(context, getter, instance)); } // private binding is just a call to the getter method... return(DefaultBinder.MakeError(((DefaultBinder)binder).MakeNonPublicMemberGetError(context, this, type, instance))); }
public override Microsoft.Scripting.Ast.Expression Call(ActionBinder binder, params Expression[] arguments) { if (Method.IsPublic && Method.DeclaringType.IsVisible) { // TODO: Need to use MethodBinder in here to make this right. return(binder.MakeCallExpression(Method, arguments)); } //methodInfo.Invoke(obj, object[] params) if (Method.IsStatic) { return(Ast.Convert( Ast.Call( Ast.RuntimeConstant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), Ast.Null(), Ast.NewArrayHelper(typeof(object[]), arguments)), Method.ReturnType)); } if (arguments.Length == 0) { throw new InvalidOperationException("no instance for call"); } return(Ast.Convert( Ast.Call( Ast.RuntimeConstant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), arguments[0], Ast.NewArrayHelper(typeof(object[]), ArrayUtils.RemoveFirst(arguments))), Method.ReturnType)); }
internal override System.Linq.Expressions.Expression Call(Expression context, ActionBinder binder, params Expression[] arguments) { if (Method.IsPublic && Method.DeclaringType.IsVisible) { // TODO: Need to use MethodBinder in here to make this right. return(binder.MakeCallExpression(context, Method, arguments)); } //methodInfo.Invoke(obj, object[] params) if (Method.IsStatic) { return(Ast.Convert( Ast.Call( Ast.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), Ast.Constant(null), AstUtils.NewArrayHelper(typeof(object), arguments) ), Method.ReturnType)); } if (arguments.Length == 0) { throw Error.NoInstanceForCall(); } return(Ast.Convert( Ast.Call( Ast.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), arguments[0], AstUtils.NewArrayHelper(typeof(object), ArrayUtils.RemoveFirst(arguments)) ), Method.ReturnType)); }
internal override DynamicMetaObject Call(OverloadResolverFactory resolverFactory, ActionBinder binder, params DynamicMetaObject[] arguments) { if (Method.IsPublic && Method.DeclaringType.IsVisible()) { return(binder.MakeCallExpression(resolverFactory, Method, arguments)); } //methodInfo.Invoke(obj, object[] params) if (Method.IsStatic) { return(new DynamicMetaObject( Expression.Convert( Expression.Call( AstUtils.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), AstUtils.Constant(null), AstUtils.NewArrayHelper(typeof(object), ArrayUtils.ConvertAll(arguments, x => x.Expression)) ), Method.ReturnType ), BindingRestrictions.Empty ) ); } if (arguments.Length == 0) { throw Error.NoInstanceForCall(); } return(new DynamicMetaObject( Expression.Convert( Expression.Call( AstUtils.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), arguments[0].Expression, AstUtils.NewArrayHelper(typeof(object), ArrayUtils.ConvertAll(ArrayUtils.RemoveFirst(arguments), x => x.Expression)) ), Method.ReturnType ), BindingRestrictions.Empty )); }
public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type) { if (!IsStatic || GetIndexParameters().Length > 0) { // need to bind to a value or parameters to get the value. return binder.ReturnMemberTracker(type, this); } MethodInfo getter = ResolveGetter(binder.PrivateBinding); if (getter == null || getter.ContainsGenericParameters) { // no usable getter return null; } if (getter.IsPublic && getter.DeclaringType.IsPublic) { return binder.MakeCallExpression(resolverFactory, getter); } // private binding is just a call to the getter method... return MemberTracker.FromMemberInfo(getter).Call(resolverFactory, binder); }
public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type instanceType) { if (!IsStatic || GetIndexParameters().Length > 0) { // need to bind to a value or parameters to get the value. return(binder.ReturnMemberTracker(instanceType, this)); } MethodInfo getter = ResolveGetter(instanceType, binder.PrivateBinding); if (getter == null || getter.ContainsGenericParameters) { // no usable getter return(null); } if (getter.IsPublic && getter.DeclaringType.IsPublic()) { return(binder.MakeCallExpression(resolverFactory, getter)); } // private binding is just a call to the getter method... return(MemberTracker.FromMemberInfo(getter).Call(resolverFactory, binder)); }
public override Expression GetValue(Expression context, ActionBinder binder, Type type) { if (!IsStatic || GetIndexParameters().Length > 0) { // need to bind to a value or parameters to get the value. return(binder.ReturnMemberTracker(type, this)); } MethodInfo getter = ResolveGetter(binder.PrivateBinding); if (getter == null || getter.ContainsGenericParameters) { // no usable getter return(null); } if (getter.IsPublic && getter.DeclaringType.IsPublic) { return(binder.MakeCallExpression(context, getter)); } // private binding is just a call to the getter method... return(MemberTracker.FromMemberInfo(getter).Call(context, binder)); }
internal override System.Linq.Expressions.Expression Call(Expression context, ActionBinder binder, params Expression[] arguments) { if (Method.IsPublic && Method.DeclaringType.IsVisible) { // TODO: Need to use MethodBinder in here to make this right. return binder.MakeCallExpression(context, Method, arguments); } //methodInfo.Invoke(obj, object[] params) if (Method.IsStatic) { return Ast.Convert( Ast.Call( Ast.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), Ast.Constant(null), AstUtils.NewArrayHelper(typeof(object), arguments) ), Method.ReturnType); } if (arguments.Length == 0) throw Error.NoInstanceForCall(); return Ast.Convert( Ast.Call( Ast.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), arguments[0], AstUtils.NewArrayHelper(typeof(object), ArrayUtils.RemoveFirst(arguments)) ), Method.ReturnType); }
internal override DynamicMetaObject Call(OverloadResolverFactory resolverFactory, ActionBinder binder, params DynamicMetaObject[] arguments) { if (Method.IsPublic && Method.DeclaringType.IsVisible) { return binder.MakeCallExpression(resolverFactory, Method, arguments); } //methodInfo.Invoke(obj, object[] params) if (Method.IsStatic) { return new DynamicMetaObject( Ast.Convert( Ast.Call( AstUtils.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), AstUtils.Constant(null), AstUtils.NewArrayHelper(typeof(object), ArrayUtils.ConvertAll(arguments, x => x.Expression)) ), Method.ReturnType ), BindingRestrictions.Empty ) ; } if (arguments.Length == 0) throw Error.NoInstanceForCall(); return new DynamicMetaObject( Ast.Convert( Ast.Call( AstUtils.Constant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), arguments[0].Expression, AstUtils.NewArrayHelper(typeof(object), ArrayUtils.ConvertAll(ArrayUtils.RemoveFirst(arguments), x => x.Expression)) ), Method.ReturnType ), BindingRestrictions.Empty ); }
public override Microsoft.Scripting.Ast.Expression Call(ActionBinder binder, params Expression[] arguments) { if (Method.IsPublic && Method.DeclaringType.IsVisible) { // TODO: Need to use MethodBinder in here to make this right. return binder.MakeCallExpression(Method, arguments); } //methodInfo.Invoke(obj, object[] params) if (Method.IsStatic) { return Ast.Convert( Ast.Call( Ast.RuntimeConstant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), Ast.Null(), Ast.NewArrayHelper(typeof(object[]), arguments)), Method.ReturnType); } if (arguments.Length == 0) throw new InvalidOperationException("no instance for call"); return Ast.Convert( Ast.Call( Ast.RuntimeConstant(Method), typeof(MethodInfo).GetMethod("Invoke", new Type[] { typeof(object), typeof(object[]) }), arguments[0], Ast.NewArrayHelper(typeof(object[]), ArrayUtils.RemoveFirst(arguments))), Method.ReturnType); }
protected internal override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) { if (instance != null && IsStatic) { return null; } if (GetIndexParameters().Length > 0) { // need to bind to a value or parameters to get the value. return binder.ReturnMemberTracker(type, BindToInstance(instance)); } MethodInfo getter = GetGetMethod(true); if (getter == null || getter.ContainsGenericParameters) { // no usable getter return null; } getter = CompilerHelpers.TryGetCallableMethod(getter); if (binder.PrivateBinding || CompilerHelpers.IsVisible(getter)) { return binder.MakeCallExpression(context, getter, instance); } // private binding is just a call to the getter method... return DefaultBinder.MakeError(((DefaultBinder)binder).MakeNonPublicMemberGetError(context, this, type, instance)); }