Fix XMM scanning on Mac x86.
[mono.git] / mcs / class / dlr / Runtime / Microsoft.Scripting.Core / Actions / CreateInstanceBinder.cs
1 /* ****************************************************************************
2  *
3  * Copyright (c) Microsoft Corporation. 
4  *
5  * This source code is subject to terms and conditions of the Apache License, Version 2.0. 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  Apache License, Version 2.0, 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 Apache License, Version 2.0.
10  *
11  * You must not remove this notice, or any other, from this software.
12  *
13  *
14  * ***************************************************************************/
15
16 using System.Dynamic.Utils;
17
18 namespace System.Dynamic {
19     /// <summary>
20     /// Represents the create dynamic operation at the call site, providing the binding semantic and the details about the operation.
21     /// </summary>
22     public abstract class CreateInstanceBinder : DynamicMetaObjectBinder {
23         private readonly CallInfo _callInfo;
24
25         /// <summary>
26         /// Initializes a new intsance of the <see cref="CreateInstanceBinder" />.
27         /// </summary>
28         /// <param name="callInfo">The signature of the arguments at the call site.</param>
29         protected CreateInstanceBinder(CallInfo callInfo) {
30             ContractUtils.RequiresNotNull(callInfo, "callInfo");
31             _callInfo = callInfo;
32         }
33
34         /// <summary>
35         /// The result type of the operation.
36         /// </summary>
37         public override sealed Type ReturnType {
38             get { return typeof(object); }
39         }
40
41         /// <summary>
42         /// Gets the signature of the arguments at the call site.
43         /// </summary>
44         public CallInfo CallInfo {
45             get { return _callInfo; }
46         }
47
48         /// <summary>
49         /// Performs the binding of the dynamic create operation if the target dynamic object cannot bind.
50         /// </summary>
51         /// <param name="target">The target of the dynamic create operation.</param>
52         /// <param name="args">The arguments of the dynamic create operation.</param>
53         /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
54         public DynamicMetaObject FallbackCreateInstance(DynamicMetaObject target, DynamicMetaObject[] args) {
55             return FallbackCreateInstance(target, args, null);
56         }
57
58         /// <summary>
59         /// When overridden in the derived class, performs the binding of the dynamic create operation if the target dynamic object cannot bind.
60         /// </summary>
61         /// <param name="target">The target of the dynamic create operation.</param>
62         /// <param name="args">The arguments of the dynamic create operation.</param>
63         /// <param name="errorSuggestion">The binding result to use if binding fails, or null.</param>
64         /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
65         public abstract DynamicMetaObject FallbackCreateInstance(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion);
66
67         /// <summary>
68         /// Performs the binding of the dynamic create operation.
69         /// </summary>
70         /// <param name="target">The target of the dynamic create operation.</param>
71         /// <param name="args">An array of arguments of the dynamic create operation.</param>
72         /// <returns>The <see cref="DynamicMetaObject"/> representing the result of the binding.</returns>
73         public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) {
74             ContractUtils.RequiresNotNull(target, "target");
75             ContractUtils.RequiresNotNullItems(args, "args");
76
77             return target.BindCreateInstance(this, args);
78         }
79
80         // this is a standard DynamicMetaObjectBinder
81         internal override sealed bool IsStandardBinder {
82             get {
83                 return true;
84             }
85         }
86     }
87 }