OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class _InvocationMirror implements InvocationMirror { | 5 class _InvocationMirror implements InvocationMirror { |
6 // Constants describing the invocation type. | 6 // Constants describing the invocation type. |
7 static final int _METHOD = 0; | 7 static final int _METHOD = 0; |
8 static final int _GETTER = 1; | 8 static final int _GETTER = 1; |
9 static final int _SETTER = 2; | 9 static final int _SETTER = 2; |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 for (int i = 0; i < numNamedArguments; i++) { | 57 for (int i = 0; i < numNamedArguments; i++) { |
58 String arg_name = _argumentsDescriptor[2 + 2*i]; | 58 String arg_name = _argumentsDescriptor[2 + 2*i]; |
59 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]]; | 59 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]]; |
60 _namedArguments[arg_name] = arg_value; | 60 _namedArguments[arg_name] = arg_value; |
61 } | 61 } |
62 } | 62 } |
63 return _namedArguments; | 63 return _namedArguments; |
64 } | 64 } |
65 | 65 |
66 bool get isMethod { | 66 bool get isMethod { |
67 if (_memberName == null) { | 67 if (_type == null) { |
68 _setMemberNameAndType(); | 68 _setMemberNameAndType(); |
69 } | 69 } |
70 return _type == _METHOD; | 70 return _type == _METHOD; |
71 } | 71 } |
72 | 72 |
73 bool get isAccessor { | 73 bool get isAccessor { |
74 if (_memberName == null) { | 74 if (_type == null) { |
75 _setMemberNameAndType(); | 75 _setMemberNameAndType(); |
76 } | 76 } |
77 return _type != _METHOD; | 77 return _type != _METHOD; |
78 } | 78 } |
79 | 79 |
80 bool get isGetter { | 80 bool get isGetter { |
81 if (_memberName == null) { | 81 if (_type == null) { |
82 _setMemberNameAndType(); | 82 _setMemberNameAndType(); |
83 } | 83 } |
84 return _type == _GETTER; | 84 return _type == _GETTER; |
85 } | 85 } |
86 | 86 |
87 bool get isSetter { | 87 bool get isSetter { |
88 if (_memberName == null) { | 88 if (_type == null) { |
89 _setMemberNameAndType(); | 89 _setMemberNameAndType(); |
90 } | 90 } |
91 return _type == _SETTER; | 91 return _type == _SETTER; |
92 } | 92 } |
93 | 93 |
94 _InvocationMirror(this._functionName, | 94 _InvocationMirror(this._functionName, |
95 this._argumentsDescriptor, | 95 this._argumentsDescriptor, |
96 this._arguments); | 96 this._arguments); |
97 | 97 |
98 static _allocateInvocationMirror(String functionName, | 98 static _allocateInvocationMirror(String functionName, |
99 List argumentsDescriptor, | 99 List argumentsDescriptor, |
100 List arguments) { | 100 List arguments) { |
101 return new _InvocationMirror(functionName, argumentsDescriptor, arguments); | 101 return new _InvocationMirror(functionName, argumentsDescriptor, arguments); |
102 } | 102 } |
103 | 103 |
104 static _invoke(Object receiver, | 104 static _invoke(Object receiver, |
105 String functionName, | 105 String functionName, |
106 List argumentsDescriptor, | 106 List argumentsDescriptor, |
107 List arguments) | 107 List arguments) |
108 native "InvocationMirror_invoke"; | 108 native "InvocationMirror_invoke"; |
109 | 109 |
110 invokeOn(Object receiver) { | 110 invokeOn(Object receiver) { |
111 _invoke(receiver, _functionName, _argumentsDescriptor, _arguments); | 111 _invoke(receiver, _functionName, _argumentsDescriptor, _arguments); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
OLD | NEW |