PageRenderTime 11ms CodeModel.GetById 7ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Runtime/Microsoft.Dynamic/Actions/BoundMemberTracker.cs

#
C# | 82 lines | 54 code | 14 blank | 14 comment | 0 complexity | f75f450fbf55b3217f74e2d107b1b781 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
16using System;
17using System.Dynamic;
18using Microsoft.Scripting.Actions.Calls;
19
20namespace Microsoft.Scripting.Actions {
21    public class BoundMemberTracker : MemberTracker {
22        private DynamicMetaObject _instance;
23        private MemberTracker _tracker;
24        private object _objInst;
25
26        public BoundMemberTracker(MemberTracker tracker, DynamicMetaObject instance) {
27            _tracker = tracker;
28            _instance = instance;
29        }
30
31        public BoundMemberTracker(MemberTracker tracker, object instance) {
32            _tracker = tracker;
33            _objInst = instance;
34        }
35
36        public override TrackerTypes MemberType {
37            get { return TrackerTypes.Bound; }
38        }
39
40        public override Type DeclaringType {
41            get { return _tracker.DeclaringType; }
42        }
43
44        public override string Name {
45            get { return _tracker.Name; }
46        }
47
48        public DynamicMetaObject Instance {
49            get {
50                return _instance;
51            }
52        }
53
54        public object ObjectInstance {
55            get {
56                return _objInst;
57            }
58        }
59
60        public MemberTracker BoundTo {
61            get {
62                return _tracker;
63            }
64        }
65
66        public override DynamicMetaObject GetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type) {
67            return _tracker.GetBoundValue(resolverFactory, binder, type, _instance);
68        }
69
70        public override ErrorInfo GetError(ActionBinder binder) {
71            return _tracker.GetBoundError(binder, _instance);
72        }
73
74        public override DynamicMetaObject SetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value) {
75            return _tracker.SetBoundValue(resolverFactory, binder, type, value, _instance);
76        }
77
78        public override DynamicMetaObject SetValue(OverloadResolverFactory resolverFactory, ActionBinder binder, Type type, DynamicMetaObject value, DynamicMetaObject errorSuggestion) {
79            return _tracker.SetBoundValue(resolverFactory, binder, type, value, _instance, errorSuggestion);
80        }
81    }
82}