PageRenderTime 23ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Languages/IronPython/IronPython/Runtime/Binding/ContextArgBuilder.cs

#
C# | 52 lines | 28 code | 7 blank | 17 comment | 0 complexity | 8d35e22f378cb08f59ca019c6a3cc45d MD5 | raw file
 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#if !CLR2
17using System.Linq.Expressions;
18#else
19using Microsoft.Scripting.Ast;
20#endif
21
22using System.Collections.Generic;
23using System.Diagnostics;
24using System.Reflection;
25using System;
26using System.Dynamic;
27using Microsoft.Scripting.Actions.Calls;
28using Microsoft.Scripting.Utils;
29
30namespace IronPython.Runtime.Binding {
31
32    /// <summary>
33    /// ArgBuilder which provides the CodeContext parameter to a method.
34    /// </summary>
35    public sealed class ContextArgBuilder : ArgBuilder {
36        public ContextArgBuilder(ParameterInfo info) 
37            : base(info){
38        }
39
40        public override int Priority {
41            get { return -1; }
42        }
43
44        public override int ConsumedArgumentCount {
45            get { return 0; }
46        }
47
48        protected override Expression ToExpression(OverloadResolver resolver, RestrictedArguments args, bool[] hasBeenUsed) {
49            return ((PythonOverloadResolver)resolver).ContextExpression;
50        }
51    }
52}