BuildAccess() static private method

static private BuildAccess ( MetaObjectBuilder metaBuilder, string methodName, CallArguments args, bool defaultFallback, bool callClrMethods ) : bool
metaBuilder MetaObjectBuilder
methodName string
args CallArguments
defaultFallback bool
callClrMethods bool
return bool
Beispiel #1
0
            public override DynamicMetaObject /*!*/ FallbackGetMember(DynamicMetaObject /*!*/ target, DynamicMetaObject errorSuggestion)
            {
#if !SILVERLIGHT
                DynamicMetaObject result;
                if (Microsoft.Scripting.ComInterop.ComBinder.TryBindGetMember(this, target, out result))
                {
                    return(result);
                }
#endif

                var metaBuilder = new MetaObjectBuilder(target);
                var callArgs    = new CallArguments(_context, target, DynamicMetaObject.EmptyMetaObjects, _CallInfo);

                // See InvokeMember binder for explanation.
                bool tryAlternateBinding = _unmangled != null && errorSuggestion == null;

                if (!RubyCallAction.BuildAccess(metaBuilder, _originalName ?? Name, callArgs, errorSuggestion == null && !tryAlternateBinding, true))
                {
                    Debug.Assert(errorSuggestion != null || tryAlternateBinding);
                    if (tryAlternateBinding)
                    {
                        metaBuilder.SetMetaResult(target.BindGetMember(_unmangled), 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(this));
            }
Beispiel #2
0
            public override DynamicMetaObject /*!*/ FallbackGetMember(DynamicMetaObject /*!*/ target, DynamicMetaObject errorSuggestion)
            {
                if (_unmangled != null)
                {
                    // TODO: errorSuggestion?
                    return(_unmangled.Bind(target, DynamicMetaObject.EmptyMetaObjects));
                }

#if !SILVERLIGHT
                DynamicMetaObject result;
                if (Microsoft.Scripting.ComInterop.ComBinder.TryBindGetMember(this, target, out result))
                {
                    return(result);
                }
#endif

                var metaBuilder = new MetaObjectBuilder(target);
                var callArgs    = new CallArguments(_context, target, DynamicMetaObject.EmptyMetaObjects, _CallInfo);

                if (!RubyCallAction.BuildAccess(metaBuilder, _originalName ?? Name, callArgs, errorSuggestion == null, true))
                {
                    Debug.Assert(errorSuggestion != null);
                    metaBuilder.SetMetaResult(errorSuggestion, false);
                }

                return(metaBuilder.CreateMetaObject(this));
            }
Beispiel #3
0
            public static DynamicMetaObject /*!*/ Bind(DynamicMetaObject /*!*/ context, GetMemberBinder /*!*/ binder, DynamicMetaObject /*!*/ target,
                                                       Func <DynamicMetaObject, DynamicMetaObject> /*!*/ fallback)
            {
                Debug.Assert(fallback != null);

                var callArgs    = new CallArguments(context, target, DynamicMetaObject.EmptyMetaObjects, RubyCallSignature.Interop(0));
                var metaBuilder = new MetaObjectBuilder(target);

                if (!RubyCallAction.BuildAccess(metaBuilder, binder.Name, callArgs, false, false))
                {
                    // TODO: error suggestion?
                    metaBuilder.SetMetaResult(fallback(target), false);
                }

                return(metaBuilder.CreateMetaObject(binder));
            }