1 /* ****************************************************************************
3 * Copyright (c) Microsoft Corporation.
5 * This source code is subject to terms and conditions of the Microsoft Public License. A
6 * copy of the license can be found in the License.html file at the root of this distribution. If
7 * you cannot locate the Microsoft Public License, please send an email to
8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
9 * by the terms of the Microsoft Public License.
11 * You must not remove this notice, or any other, from this software.
14 * ***************************************************************************/
15 using System; using Microsoft;
19 using System.Dynamic.Utils;
21 using Microsoft.Scripting.Utils;
25 namespace System.Dynamic {
27 namespace Microsoft.Scripting {
30 /// Represents the dynamic delete index operation at the call site, providing the binding semantic and the details about the operation.
32 public abstract class DeleteIndexBinder : DynamicMetaObjectBinder {
33 private readonly CallInfo _callInfo;
36 /// Initializes a new instance of the <see cref="DeleteIndexBinder" />.
38 /// <param name="callInfo">The signature of the arguments at the call site.</param>
39 protected DeleteIndexBinder(CallInfo callInfo) {
40 ContractUtils.RequiresNotNull(callInfo, "callInfo");
45 /// The result type of the operation.
47 public override sealed Type ReturnType {
48 get { return typeof(void); }
52 /// Gets the signature of the arguments at the call site.
54 public CallInfo CallInfo {
55 get { return _callInfo; }
59 /// Performs the binding of the dynamic delete index operation.
61 /// <param name="target">The target of the dynamic delete index operation.</param>
62 /// <param name="args">An array of arguments of the dynamic delete index operation.</param>
63 /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
64 public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) {
65 ContractUtils.RequiresNotNull(target, "target");
66 ContractUtils.RequiresNotNullItems(args, "args");
68 return target.BindDeleteIndex(this, args);
71 // this is a standard DynamicMetaObjectBinder
72 internal override sealed bool IsStandardBinder {
79 /// Performs the binding of the dynamic delete index operation if the target dynamic object cannot bind.
81 /// <param name="target">The target of the dynamic delete index operation.</param>
82 /// <param name="indexes">The arguments of the dynamic delete index operation.</param>
83 /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
84 public DynamicMetaObject FallbackDeleteIndex(DynamicMetaObject target, DynamicMetaObject[] indexes) {
85 return FallbackDeleteIndex(target, indexes, null);
89 /// When overridden in the derived class, performs the binding of the dynamic delete index operation if the target dynamic object cannot bind.
91 /// <param name="target">The target of the dynamic delete index operation.</param>
92 /// <param name="indexes">The arguments of the dynamic delete index operation.</param>
93 /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param>
94 /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
95 public abstract DynamicMetaObject FallbackDeleteIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion);