/// <summary>
        /// Performs the binding of the dynamic set index operation.
        /// </summary>
        /// <param name="target">The target of the dynamic set index operation.</param>
        /// <param name="args">An array of arguments of the dynamic set index operation.</param>
        /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
        public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) {
            ContractUtils.RequiresNotNull(target, "target");
            ContractUtils.RequiresNotNull(args, "args");
            ContractUtils.Requires(args.Length >= 2, "args");

            DynamicMetaObject value = args[args.Length - 1];
            DynamicMetaObject[] indexes = args.RemoveLast();

            ContractUtils.RequiresNotNull(value, "args");
            ContractUtils.RequiresNotNullItems(indexes, "args");

            return target.BindSetIndex(this, indexes, value);
        }
Exemplo n.º 2
0
 public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value)
 {
     return(scriptItem.PostProcessBindResult(metaDynamic.BindSetIndex(binder, indexes, value)));
 }
Exemplo n.º 3
0
        public static bool TryBindSetIndex(SetIndexBinder binder, DynamicMetaObject instance, DynamicMetaObject[] args, DynamicMetaObject value, out DynamicMetaObject result) {
            ContractUtils.RequiresNotNull(binder, "binder");
            ContractUtils.RequiresNotNull(instance, "instance");
            ContractUtils.RequiresNotNull(args, "args");
            ContractUtils.RequiresNotNull(value, "value");

            if (TryGetMetaObject(ref instance)) {
                //
                // Demand Full Trust to proceed with the binding.
                //

                new PermissionSet(PermissionState.Unrestricted).Demand();

                result = instance.BindSetIndex(binder, args, value);
                return true;
            } else {
                result = null;
                return false;
            }
        }
Exemplo n.º 4
0
 public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value)
 {
     return(AddRestrictions(_metaForwardee.BindSetIndex(binder, indexes, value)));
 }
Exemplo n.º 5
0
 public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value)
 {
     return(metaObject.BindSetIndex(binder, indexes, value));
 }