internal static DynamicMetaObject FallbackInvokeMember(IInteropBinder /*!*/ binder, string /*!*/ methodName, CallInfo /*!*/ callInfo, DynamicMetaObject /*!*/ target, DynamicMetaObject /*!*/[] /*!*/ args, DynamicMetaObject errorSuggestion, InvokeMember alternateBinder) { var metaBuilder = new MetaObjectBuilder(binder, target, args); var callArgs = new CallArguments(binder.Context, target, args, callInfo); // // If we are called with no errorSuggestion we attempt to bind the alternate name since the current binding failed // (unless we successfully bind to a COM object method or Ruby/CLR method defined on the target meta-object). // If we already have an errorSuggestion we use it as it represents a valid binding and no alternate name lookups are thus necessary. // // For example, DynamicObject InvokeMember calls our FallbackInvokeMember 4 times: // // 1) binder.fallback(..., errorSuggestion: null) // -> DynamicObject.BindInvokeMember(altBinder) // 2) altBinder.fallback(..., errorSuggestion: null) // -> [[ error ]] // // 3) altBinder.fallback(..., errorSuggestion: [[ // TryInvokeMember(altName, out result) // ? result // : TryGetMember(altName, out result) // ? altBinder.FallbackInvoke(result) // : [[ error ]] // ]]) // -> errorSuggestion // // 4) binder.fallback(..., errorSuggestion: [[ // TryInvokeMember(name, out result) // ? result // : TryGetMember(name, out result) // ? binder.FallbackInvoke(result) // TryInvokeMember(altName, out result) // ? result // : TryGetMember(altName, out result) // ? altBinder.FallbackInvoke(result) // : [[ error ]] // // ]]) // -> errorSuggestion // bool tryAlternateBinding = alternateBinder != null && errorSuggestion == null; if (!RubyCallAction.BuildCall(metaBuilder, methodName, callArgs, errorSuggestion == null && !tryAlternateBinding, true)) { Debug.Assert(errorSuggestion != null || tryAlternateBinding); if (tryAlternateBinding) { metaBuilder.SetMetaResult(target.BindInvokeMember(alternateBinder, args), true); } else { // method wasn't found so we didn't do any operation with arguments that would require restrictions converted to conditions: metaBuilder.SetMetaResult(errorSuggestion, false); } } return(metaBuilder.CreateMetaObject((DynamicMetaObjectBinder)binder)); }
internal static DynamicMetaObject FallbackInvokeMember(IInteropBinder /*!*/ binder, string /*!*/ methodName, CallInfo /*!*/ callInfo, DynamicMetaObject /*!*/ target, DynamicMetaObject /*!*/[] /*!*/ args, DynamicMetaObject errorSuggestion) { var metaBuilder = new MetaObjectBuilder(binder, target, args); var callArgs = new CallArguments(binder.Context, target, args, callInfo); if (!RubyCallAction.BuildCall(metaBuilder, methodName, callArgs, errorSuggestion == null, true)) { Debug.Assert(errorSuggestion != null); // method wasn't found so we didn't do any operation with arguments that would require restrictions converted to conditions: metaBuilder.SetMetaResult(errorSuggestion, false); } return(metaBuilder.CreateMetaObject((DynamicMetaObjectBinder)binder)); }
internal MetaObjectBuilder(IInteropBinder /*!*/ binder, DynamicMetaObject target, params DynamicMetaObject /*!*/[] /*!*/ arguments) : this(binder.Context, target, arguments) { }
internal static DynamicMetaObject FallbackInvokeMember(IInteropBinder/*!*/ binder, string/*!*/ methodName, CallInfo/*!*/ callInfo, DynamicMetaObject/*!*/ target, DynamicMetaObject/*!*/[]/*!*/ args, DynamicMetaObject errorSuggestion) { var metaBuilder = new MetaObjectBuilder(binder, target, args); var callArgs = new CallArguments(binder.Context, target, args, callInfo); if (!RubyCallAction.BuildCall(metaBuilder, methodName, callArgs, errorSuggestion == null, true)) { Debug.Assert(errorSuggestion != null); // method wasn't found so we didn't do any operation with arguments that would require restrictions converted to conditions: metaBuilder.SetMetaResult(errorSuggestion, false); } return metaBuilder.CreateMetaObject((DynamicMetaObjectBinder)binder); }
internal MetaObjectBuilder(IInteropBinder/*!*/ binder, DynamicMetaObject target, params DynamicMetaObject/*!*/[]/*!*/ arguments) : this(binder.Context, target, arguments) { }
public DynamicMetaObject CreateMetaObject(IInteropBinder binder) { return(new DynamicMetaObject(_metaResult, _restrictions)); }
public DynamicMetaObject CreateMetaObject(IInteropBinder binder) { return new DynamicMetaObject(_metaResult, _restrictions); }