protected override DynamicMetaObject SetBoundValue(OverloadResolverFactory factory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject instance, DynamicMetaObject errorSuggestion) {
     return new DynamicMetaObject(
         Expression.Condition(
             Ast.Call(
                 typeof(PythonOps).GetMethod("SlotTrySetValue"),
                 ((PythonOverloadResolverFactory)factory)._codeContext,
                 AstUtils.Constant(GetSlot(), typeof(PythonTypeSlot)),
                 AstUtils.Convert(
                     instance.Expression,
                     typeof(object)
                 ),
                 AstUtils.Constant(DynamicHelpers.GetPythonTypeFromType(type)),
                 value.Expression
             ),
             AstUtils.Convert(value.Expression, typeof(object)),
             errorSuggestion != null ?
                 errorSuggestion.Expression :
                 Expression.Throw(
                     Expression.Call(
                         typeof(PythonOps).GetMethod("AttributeErrorForMissingAttribute", new Type[] { typeof(object), typeof(string) }),
                         instance.Expression,
                         Expression.Constant(Name)
                     ),
                     typeof(object)
                 )
         ),
         BindingRestrictions.Empty
     );
 }
예제 #2
0
        public ParameterWrapper(ActionBinder binder, ParameterInfo info)
            : this(binder, info.ParameterType)
        {
            _name = SymbolTable.StringToId(info.Name ?? "<unknown>");

            _isParams = info.IsDefined(typeof(ParamArrayAttribute), false);
        }
예제 #3
0
파일: ToyEngine.cs 프로젝트: xxjeng/nuxleus
        public ToyEngine(LanguageProvider provider, EngineOptions engineOptions) : base(provider, engineOptions) {
            IronPython.Runtime.Operations.Ops.Bool2Object(true); //awful initialization hack

            IronPython.Runtime.Operations.Ops.RegisterAssembly(typeof(ToyEngine).Assembly);

            _defaultContext = new ToyContext(this);
            _defaultBinder = new DefaultActionBinder(new CodeContext(null, _defaultContext));
        }
예제 #4
0
        /// <summary>
        /// Internal helper to produce the actual expression used for the error when emitting
        /// the error into a rule.
        /// </summary>
        public Statement MakeErrorForRule(StandardRule rule, ActionBinder binder) {
            if (_value != null) {
                rule.IsError = true;
                return rule.MakeReturn(binder, _value);
            }

            return rule.MakeError(_exception);
        } 
예제 #5
0
        public DefaultOverloadResolver(ActionBinder binder, IList<DynamicMetaObject> args, CallSignature signature, CallTypes callType)
            : base(binder) {
            ContractUtils.RequiresNotNullItems(args, "args");

            Debug.Assert((callType == CallTypes.ImplicitInstance ? 1 : 0) + signature.ArgumentCount == args.Count);
            _args = args;
            _signature = signature;
            _callType = callType;
        }
예제 #6
0
 public Expression GetBoundPythonValue(RuleBuilder builder, ActionBinder binder, PythonType accessing) {
     return Ast.Call(
         typeof(PythonOps).GetMethod("SlotGetValue"),
         builder.Context,
         Ast.Constant(GetSlot(), typeof(PythonTypeSlot)),
         Ast.Constant(null),
         Ast.Constant(accessing)
     );
 }
예제 #7
0
        public RubyParameterBinder(ActionBinder/*!*/ binder, Expression/*!*/ scopeOrContextExpression, bool isScope)
            : base(binder) {
            Assert.NotNull(binder, scopeOrContextExpression);

            if (isScope) {
                _scopeExpression = AstUtils.Convert(scopeOrContextExpression, typeof(RubyScope));
            } else {
                _contextExpression = AstUtils.Convert(scopeOrContextExpression, typeof(RubyContext));
            }
        }
예제 #8
0
 protected override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) {
     return Ast.Call(
         typeof(PythonOps).GetMethod("SlotGetValue"),
         context,
         Ast.Constant(GetSlot(), typeof(PythonTypeSlot)),
         AstUtils.Convert(
             instance,
             typeof(object)
         ),
         Ast.Constant(DynamicHelpers.GetPythonTypeFromType(type))
     );
 }
예제 #9
0
 public ParameterWrapper(ActionBinder binder, ParameterInfo info, Type type, SymbolId name, bool prohibitNull, bool isParams, bool isParamsDict) {
     ContractUtils.RequiresNotNull(binder, "binder");
     ContractUtils.RequiresNotNull(type, "type");
     
     _type = type;
     _prohibitNull = prohibitNull;
     _binder = binder;
     _info = info;
     _name = name;
     _isParams = isParams;
     _isParamsDict = isParamsDict;
 }
예제 #10
0
        public override ErrorInfo GetError(ActionBinder binder) {
            MethodInfo getter = ResolveGetter(binder.PrivateBinding);

            if (getter == null) {
                return binder.MakeMissingMemberErrorInfo(DeclaringType, Name);
            }

            if (getter.ContainsGenericParameters) {
                return binder.MakeGenericAccessError(this);
            }

            throw new InvalidOperationException();
        }
예제 #11
0
        public ParameterWrapper(ActionBinder binder, ParameterInfo info)
            : this(binder, info, info.ParameterType, SymbolId.Empty, false, false, false) {

            _prohibitNull = CompilerHelpers.ProhibitsNull(info);
            _isParams = CompilerHelpers.IsParamArray(info);
            _isParamsDict = BinderHelpers.IsParamDictionary(info);
            if (_isParams || _isParamsDict) {
                // params arrays & dictionaries don't allow assignment by keyword
                _name = SymbolTable.StringToId("<unknown>");
            } else {
                _name = SymbolTable.StringToId(info.Name ?? "<unknown>");
            }
        }
예제 #12
0
        public MethodBinderContext(ActionBinder actionBinder
#if FULL
, StandardRule rule 
#endif
)
        {
            _actionBinder = actionBinder;

#if FULL
 _rule = rule; 
#endif

        }
예제 #13
0
 protected override DynamicMetaObject GetBoundValue(OverloadResolverFactory factory, ActionBinder binder, Type type, DynamicMetaObject instance) {
     return new DynamicMetaObject(
         Ast.Call(
             typeof(PythonOps).GetMethod("SlotGetValue"),
             ((PythonOverloadResolverFactory)factory)._codeContext,
             AstUtils.Constant(GetSlot(), typeof(PythonTypeSlot)),
             AstUtils.Convert(
                 instance.Expression,
                 typeof(object)
             ),
             AstUtils.Constant(DynamicHelpers.GetPythonTypeFromType(type))
         ),
         BindingRestrictions.Empty
     );
 }
예제 #14
0
        public ParameterWrapper(ActionBinder binder, ParameterInfo info)
            : this(binder, info.ParameterType) {
            _name = SymbolTable.StringToId(info.Name ?? "<unknown>");

#if FULL
            _prohibitNull = info.IsDefined(typeof(NotNullAttribute), false); 
#endif

            _isParams = info.IsDefined(typeof(ParamArrayAttribute), false);

#if FULL
            _isParamsDict = info.IsDefined(typeof(ParamDictionaryAttribute), false); 
#endif

            }
예제 #15
0
        internal static void Initialize(IronSchemeLanguageProvider ironSchemeLanguageProvider)
        {
            lp = ironSchemeLanguageProvider;
              se = lp.GetEngine() as IronSchemeScriptEngine;

              scriptmodule = ScriptDomainManager.CurrentManager.Host.DefaultModule as ScriptModule;

              ModuleContext mc = new ModuleContext(scriptmodule);

              mc.CompilerContext = new CompilerContext(SourceUnit.CreateSnippet(se, ""));

              cc = new CodeContext(scriptmodule.Scope, se.GetLanguageContext(), mc);

              binder = new IronScheme.Actions.IronSchemeActionBinder(cc);

              Generator.initme = true;
        }
예제 #16
0
 public static MSA.DynamicExpression/*!*/ MakeCallAction(string/*!*/ name, ActionBinder/*!*/ binder, RubyCallSignature signature, 
     params MSA.Expression[]/*!*/ args) {
     RubyCallAction call = RubyCallAction.Make(name, signature);
     switch (args.Length) {
         case 0: return Ast.Dynamic(call, typeof(object), AstFactory.EmptyExpressions);
         case 1: return Ast.Dynamic(call, typeof(object), args[0]);
         case 2: return Ast.Dynamic(call, typeof(object), args[0], args[1]);
         case 3: return Ast.Dynamic(call, typeof(object), args[0], args[1], args[2]);
         case 4: return Ast.Dynamic(call, typeof(object), args[0], args[1], args[2], args[3]);
         default:
             return Ast.Dynamic(
                 call,
                 typeof(object),
                 new ReadOnlyCollection<MSA.Expression>(args)
             );
     }
 }
예제 #17
0
        public override ErrorInfo GetBoundError(ActionBinder binder, DynamicMetaObject instance, Type instanceType)
        {
            MethodInfo getter = ResolveGetter(instanceType, binder.PrivateBinding);

            if (getter == null) {
                return binder.MakeMissingMemberErrorInfo(DeclaringType, Name);
            }

            if (getter.ContainsGenericParameters) {
                return binder.MakeGenericAccessError(this);
            }

            if (IsStatic) {
                return binder.MakeStaticPropertyInstanceAccessError(this, false, instance);
            }

            throw new InvalidOperationException();
        }
예제 #18
0
        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);
        }
예제 #19
0
        private MethodBinder(ActionBinder binder, string name, IList<MethodBase> methods, BinderType binderType, SymbolId[] kwArgs)
        {
            _binder = binder;
            _name = name;
            _binderType = binderType;
            _kwArgs = kwArgs;
            foreach (MethodBase method in methods) {
                if (IsUnsupported(method)) continue;

                AddBasicMethodTargets(method);
            }

            if (_paramsCandidates != null) {
                foreach (MethodCandidate maker in _paramsCandidates) {
                    foreach (int count in _targetSets.Keys) {
                        MethodCandidate target = maker.MakeParamsExtended(binder, count, _kwArgs);
                        if (target != null) AddTarget(target);
                    }
                }
            }
        }
예제 #20
0
 public ParameterWrapper(ActionBinder binder, Type type, bool prohibitNull, SymbolId name) 
     : this(binder, type, prohibitNull) {
     _name = name;
 }
예제 #21
0
 public ParameterWrapper(ActionBinder binder, Type type, SymbolId name) 
     : this(binder, type) {
     _name = name;
 }
예제 #22
0
 public override DynamicMetaObject GetBoundValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject instance)
 {
     return(binder.ReturnMemberTracker(type, BindToInstance(instance)));
 }
예제 #23
0
 public static OldDeleteMemberAction Make(ActionBinder binder, string name)
 {
     return(Make(binder, SymbolTable.StringToId(name)));
 }
예제 #24
0
        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
                       ));
        }
예제 #25
0
        protected internal override DynamicMetaObject GetBoundValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject instance)
        {
            if (IsPublic && DeclaringType.IsVisible)
            {
                return(new DynamicMetaObject(
                           AstUtils.Convert(
                               Expression.Field(
                                   AstUtils.Convert(instance.Expression, Field.DeclaringType),
                                   Field
                                   ),
                               typeof(object)
                               ),
                           BindingRestrictions.Empty
                           ));
            }

            return(DefaultBinder.MakeError(((DefaultBinder)binder).MakeNonPublicMemberGetError(resolverFactory, this, type, instance), BindingRestrictions.Empty, typeof(object)));
        }
예제 #26
0
 /// <summary>
 /// Gets an expression that assigns a value to the left hand side.
 ///
 /// Returns null if it's an error to assign to.  The caller can then call GetErrorForSet to
 /// get the correct error Expression (or null if a default error should be provided).
 /// </summary>
 public virtual DynamicMetaObject SetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type instanceType, DynamicMetaObject value)
 {
     return(null);
 }
예제 #27
0
 public static OldCallAction Make(ActionBinder binder, CallSignature signature)
 {
     ContractUtils.RequiresNotNull(binder, "binder");
     return(new OldCallAction(binder, signature));
 }
예제 #28
0
 protected OldCallAction(ActionBinder binder, CallSignature callSignature)
 {
     _binder    = binder;
     _signature = callSignature;
 }
예제 #29
0
 /// <summary>
 /// Returns the error associated with getting the value.
 ///
 /// A null return value indicates that the default error message should be provided by the caller.
 /// </summary>
 public virtual ErrorInfo GetError(ActionBinder binder, Type instanceType)
 {
     return(null);
 }
예제 #30
0
 public override DynamicMetaObject SetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value) {
     return SetBoundValue(resolverFactory, binder, type, value, new DynamicMetaObject(AstUtils.Constant(null), BindingRestrictions.Empty));
 }
예제 #31
0
 public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type) {
     return new DynamicMetaObject(AstUtils.Constant(GetSlot(), typeof(PythonTypeSlot)), BindingRestrictions.Empty);
 }
예제 #32
0
 protected internal override DynamicMetaObject GetBoundValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject instance)
 {
     return binder.ReturnMemberTracker(type, BindToInstance(instance));
 }
예제 #33
0
 public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type instanceType)
 {
     return base.GetValue(resolverFactory, binder, instanceType);
 }
예제 #34
0
 /// <summary>
 /// Helper for setting values that have been bound.  Called from BoundMemberTracker.  Custom member
 /// trackers can override this to provide their own behaviors when bound to an instance.
 /// </summary>
 public virtual DynamicMetaObject SetBoundValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type instanceType, DynamicMetaObject value, DynamicMetaObject instance)
 {
     return(SetValue(resolverFactory, binder, instanceType, instance));
 }
예제 #35
0
 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Call")] // TODO: fix
 internal virtual DynamicMetaObject Call(OverloadResolverFactory resolverFactory, ActionBinder binder, params DynamicMetaObject[] arguments)
 {
     return(null);
 }
예제 #36
0
 public static OldCallAction Make(ActionBinder binder, int argumentCount)
 {
     ContractUtils.Requires(argumentCount >= 0, "argumentCount");
     ContractUtils.RequiresNotNull(binder, "binder");
     return(new OldCallAction(binder, new CallSignature(argumentCount)));
 }
예제 #37
0
 /// <summary>
 /// Helper for setting values that have been bound.  Called from BoundMemberTracker.  Custom member
 /// trackers can override this to provide their own behaviors when bound to an instance.
 /// </summary>
 protected internal virtual Expression SetBoundValue(Expression context, ActionBinder binder, Type type, Expression value, Expression instance)
 {
     return(SetValue(context, binder, type, instance));
 }
예제 #38
0
 protected internal override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance) {
     return binder.ReturnMemberTracker(type, BindToInstance(instance));
 }
예제 #39
0
        public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type)
        {
            if (Field.IsLiteral)
            {
                return(new DynamicMetaObject(
                           AstUtils.Constant(Field.GetValue(null), typeof(object)),
                           BindingRestrictions.Empty
                           ));
            }

            if (!IsStatic)
            {
                // return the field tracker...
                return(binder.ReturnMemberTracker(type, this));
            }

            if (Field.DeclaringType.ContainsGenericParameters)
            {
                return(null);
            }

            if (IsPublic && DeclaringType.IsPublic)
            {
                return(new DynamicMetaObject(
                           Expression.Convert(Expression.Field(null, Field), typeof(object)),
                           BindingRestrictions.Empty
                           ));
            }

            return(new DynamicMetaObject(
                       Expression.Call(
                           AstUtils.Convert(AstUtils.Constant(Field), typeof(FieldInfo)),
                           typeof(FieldInfo).GetMethod("GetValue"),
                           AstUtils.Constant(null)
                           ),
                       BindingRestrictions.Empty
                       ));
        }
예제 #40
0
        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);
        }
예제 #41
0
 private OldDeleteMemberAction(ActionBinder binder, SymbolId name)
     : base(binder, name)
 {
 }
예제 #42
0
 protected internal override Expression GetBoundValue(Expression context, ActionBinder binder, Type type, Expression instance)
 {
     return(binder.ReturnMemberTracker(type, BindToInstance(instance)));
 }
예제 #43
0
 public static OldDeleteMemberAction Make(ActionBinder binder, SymbolId name)
 {
     ContractUtils.RequiresNotNull(binder, "binder");
     return(new OldDeleteMemberAction(binder, name));
 }
예제 #44
0
 public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type instanceType)
 {
     return(BoundTo.GetBoundValue(resolverFactory, binder, instanceType, Instance));
 }
예제 #45
0
 public ParameterWrapper(ActionBinder binder, Type type) {
     _type = type;
     _binder = binder;
 }
예제 #46
0
 public override DynamicMetaObject SetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type instanceType, DynamicMetaObject value, DynamicMetaObject errorSuggestion)
 {
     return(BoundTo.SetBoundValue(resolverFactory, binder, instanceType, value, Instance, errorSuggestion));
 }
예제 #47
0
 public ParameterWrapper(ActionBinder binder, Type type, bool prohibitNull) {
     _type = type;
     _prohibitNull = prohibitNull;
     _binder = binder;
 }
예제 #48
0
 // method call:
 public DefaultOverloadResolver(ActionBinder binder, IList <DynamicMetaObject> args, CallSignature signature)
     : this(binder, args, signature, CallTypes.None)
 {
 }
예제 #49
0
        protected internal override DynamicMetaObject GetBoundValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject 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);
            }

            // TODO (tomat): this used to use getter.ReflectedType, is it still correct?
            getter = CompilerHelpers.TryGetCallableMethod(instance.GetLimitType(), getter);

            var defaultBinder = (DefaultBinder)binder;

            if (binder.PrivateBinding || CompilerHelpers.IsVisible(getter))
            {
                return(defaultBinder.MakeCallExpression(resolverFactory, getter, instance));
            }

            // private binding is just a call to the getter method...
            return(DefaultBinder.MakeError(defaultBinder.MakeNonPublicMemberGetError(resolverFactory, this, type, instance), BindingRestrictions.Empty, typeof(object)));
        }
예제 #50
0
 /// <summary>
 /// Returns the error associated with accessing this member via a bound instance.
 ///
 /// A null return value indicates that the default error message should be provided by the caller.
 /// </summary>
 public virtual ErrorInfo GetBoundError(ActionBinder binder, DynamicMetaObject instance, Type instanceType)
 {
     return(null);
 }
예제 #51
0
 public override Expression GetValue(Expression context, ActionBinder binder, Type type)
 {
     return(base.GetValue(context, binder, type));
 }
예제 #52
0
 /// <summary>
 /// Gets the expression that creates the value.
 ///
 /// Returns null if it's an error to get the value.  The caller can then call GetErrorForGet to get
 /// the correct error Expression (or null if they should provide a default).
 /// </summary>
 public virtual Expression GetValue(Expression context, ActionBinder binder, Type type)
 {
     return(binder.ReturnMemberTracker(type, this));
 }
예제 #53
0
 public override ErrorInfo GetError(ActionBinder binder, Type instanceType)
 {
     return(BoundTo.GetBoundError(binder, Instance, instanceType));
 }
예제 #54
0
 /// <summary>
 /// Gets an expression that assigns a value to the left hand side.
 ///
 /// Returns null if it's an error to assign to.  The caller can then call GetErrorForSet to
 /// get the correct error Expression (or null if a default error should be provided).
 /// </summary>
 public virtual Expression SetValue(Expression context, ActionBinder binder, Type type, Expression value)
 {
     return(null);
 }
예제 #55
0
 // instance method call:
 public DefaultOverloadResolver(ActionBinder binder, DynamicMetaObject instance, IList <DynamicMetaObject> args, CallSignature signature)
     : this(binder, ArrayUtils.Insert(instance, args), signature, CallTypes.ImplicitInstance)
 {
 }
예제 #56
0
 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Call")] // TODO: fix
 internal virtual Expression Call(Expression context, ActionBinder binder, params Expression[] arguments)
 {
     return(null);
 }
예제 #57
0
 /// <summary>
 /// ParameterInfo is not available.
 /// </summary>
 public ParameterWrapper(ActionBinder binder, Type type, SymbolId name, bool prohibitNull)
     : this(binder, null, type, name, prohibitNull, false, false) {
 }
예제 #58
0
 /// <summary>
 /// Returns the error associated with getting the value.
 ///
 /// A null return value indicates that the default error message should be provided by the caller.
 /// </summary>
 public virtual ErrorInfo GetError(ActionBinder binder)
 {
     return(null);
 }
예제 #59
0
        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));
        }
예제 #60
0
 /// <summary>
 /// Returns the error associated with accessing this member via a bound instance.
 ///
 /// A null return value indicates that the default error message should be provided by the caller.
 /// </summary>
 public virtual ErrorInfo GetBoundError(ActionBinder binder, Expression instance)
 {
     return(null);
 }