Esempio n. 1
0
        internal static DynamicMetaObject CreateMetaObject(
            DynamicMetaObject originalExpressionMO,
            GetIndexBinder binder,
            DynamicMetaObject[] indexes)
        {
            // Generate an expression like this:
            //
            //     new ArmIndexAccessExpression((ArmOperation)dynamicObject, new ArmIntegerLiteral(indexes[0]))
            //
            var expression = Expression.New(
                typeof(ArmIndexAccessExpression).GetConstructor(new[] { typeof(ArmOperation), typeof(ArmExpression) }),
                new Expression[]
            {
                Expression.Convert(
                    // Note that here we must use the magic value of originalExpressionMO.Expression
                    // Otherwise we'll get the value for the first metadata object that activates this method forever (it's cached)
                    originalExpressionMO.Expression,
                    typeof(ArmOperation)),
                Expression.New(
                    typeof(ArmIntegerLiteral).GetConstructor(new[] { typeof(long) }),
                    new Expression[]
                {
                    Expression.Convert(indexes[0].Expression, typeof(long))
                })
            });


            var restrictions = originalExpressionMO.Restrictions.Merge(binder.FallbackGetIndex(originalExpressionMO, indexes).Restrictions);

            return(new DynamicMetaObject(expression, restrictions));
        }
Esempio n. 2
0
        public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
        {
            DynamicMetaObject messageSendMO;

            if (createMetaObjectToSendMessage("at:", argArrayFor(indexes), out messageSendMO))
            {
                return(messageSendMO);
            }
            return(binder.FallbackGetIndex(this, indexes, messageSendMO));
        }
Esempio n. 3
0
                }                 // func BindInvokeMember

                public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
                {
                    if (!HasValue)
                    {
                        return(binder.Defer(this, indexes));
                    }

                    // redirect to the item
                    return(binder.FallbackGetIndex(GetRawItemBinder(), indexes));
                }         // func BindGetIndex
 public override DynamicMetaObject BindGetIndex(
     GetIndexBinder binder,
     DynamicMetaObject[] indexes
     )
 {
     return(IsOverridden(nameof(DynamicProxy <T> .TryGetIndex))
       ? CallMethodWithResult(
                nameof(DynamicProxy <T> .TryGetIndex),
                binder,
                GetArgArray(indexes),
                e => binder.FallbackGetIndex(this, indexes, e)
                )
       : base.BindGetIndex(binder, indexes));
 }
Esempio n. 5
0
        public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
        {
            Logger.Log(LogLevel.Debug, null, "BindGetIndex");

            var a2 = Expression.NewArrayInit(typeof(object), indexes.Select(x => Expression.Convert(x.Expression, typeof(Object))));

            var binderFallback = binder.FallbackGetIndex(this, indexes);

            var call = Expression.Call(
                GetClayBehavior(),
                IClayBehavior_GetIndex,
                Expression.Lambda(binderFallback.Expression),
                GetLimitedSelf(),
                a2);

            return(new DynamicMetaObject(call, BindingRestrictions.GetTypeRestriction(Expression, LimitType).Merge(binderFallback.Restrictions)));
        }
Esempio n. 6
0
 public override DynamicMetaObject _0001(GetIndexBinder var1, DynamicMetaObject[] vis)
 {
     //Discarded unreachable code: IL_0002
     //IL_0003: Incompatible stack heights: 0 vs 1
     if (!CancelProperty("TryGetIndex"))
     {
         return(base.BindGetIndex(var1, vis));
     }
     return(DefineProperty("TryGetIndex", var1, WorkerClientBridge <T> ._0001(vis), (DynamicMetaObject P_0) => var1.FallbackGetIndex(this, vis, P_0)));
 }
Esempio n. 7
0
 public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes) {
     ContractUtils.RequiresNotNull(binder, nameof(binder));
     return binder.FallbackGetIndex(UnwrapSelf(), indexes);
 }
Esempio n. 8
0
            }             // func BindBinaryOperation

            public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
            {
                return(binder.FallbackGetIndex(this, indexes));
            }             // func BindGetIndex
 public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes) {
     ContractUtils.RequiresNotNull(binder, "binder");
     return binder.FallbackGetIndex(UnwrapSelf(), indexes);
 }
Esempio n. 10
0
 public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
 {
     return(_runtime.TryGetIndex != null
          ? CallMethodWithResult("TryGetIndex", binder, GetArgArray(indexes), e => binder.FallbackGetIndex(this, indexes, e))
          : base.BindGetIndex(binder, indexes));
 }
Esempio n. 11
0
 public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
 {
     return(binder.FallbackGetIndex(_baseMetaObject,
                                    indexes,
                                    AddTypeRestrictions(_metaObject.BindGetIndex(binder, indexes))));
 }
Esempio n. 12
0
 public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
 {
     return(this.IsOverridden("TryGetIndex")
            ? this.CallMethodWithResult("TryGetIndex", binder, GetArgArray(indexes), e => binder.FallbackGetIndex(this, indexes, e))
            : base.BindGetIndex(binder, indexes));
 }
Esempio n. 13
0
 /// <summary>
 /// Performs the binding of the dynamic get index operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="GetIndexBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="indexes">An array of <see cref="DynamicMetaObject"/> instances - indexes for the get index operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
 {
     ContractUtils.RequiresNotNull(binder, "binder");
     return(binder.FallbackGetIndex(this, indexes));
 }
Esempio n. 14
0
 public override MetaObject BindGetIndex(GetIndexBinder binder, MetaObject[] indexes)
 {
     ContractUtils.RequiresNotNull(binder, "binder");
     return(binder.FallbackGetIndex(UnwrapSelf(), indexes));
 }
            public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes) {
                if (IsOverridden("TryGetIndex")) {
                    return CallMethodWithResult("TryGetIndex", binder, GetArgArray(indexes), (e) => binder.FallbackGetIndex(this, indexes, e));
                }

                return base.BindGetIndex(binder, indexes);
            }
 /// <summary>
 /// Performs the binding of the dynamic get index operation.
 /// </summary>
 /// <param name="binder">An instance of the <see cref="GetIndexBinder"/> that represents the details of the dynamic operation.</param>
 /// <param name="indexes">An array of <see cref="DynamicMetaObject"/> instances - indexes for the get index operation.</param>
 /// <returns>The new <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
 public virtual DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes) {
     ContractUtils.RequiresNotNull(binder, "binder");
     return binder.FallbackGetIndex(this, indexes);
 }
Esempio n. 17
0
 public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
 {
     if (!this.IsOverridden("TryGetIndex"))
     {
         return(base.BindGetIndex(binder, indexes));
     }
     return(this.CallMethodWithResult("TryGetIndex", binder, DynamicProxyMetaObject <T> .GetArgArray(indexes), (DynamicMetaObject e) => binder.FallbackGetIndex(this, indexes, e), null));
 }
Esempio n. 18
0
        public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
        {
            if (IsOverridden("TryGetIndex"))
            {
                return(CallMethodWithResult("TryGetIndex", binder, GetExpressions(indexes), (e) => binder.FallbackGetIndex(this, indexes, e)));
            }

            return(base.BindGetIndex(binder, indexes));
        }
Esempio n. 19
0
 public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes)
 {
     return(binder.FallbackGetIndex(UnwrapSelf(), indexes));
 }