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 Invocation { | 5 class _InvocationMirror implements Invocation { |
6 // Constants describing the invocation type. | 6 // Constants describing the invocation type. |
7 // _FIELD cannot be generated by regular invocation mirrors. | 7 // _FIELD cannot be generated by regular invocation mirrors. |
8 static const int _METHOD = 0; | 8 static const int _METHOD = 0; |
9 static const int _GETTER = 1; | 9 static const int _GETTER = 1; |
10 static const int _SETTER = 2; | 10 static const int _SETTER = 2; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 return _positionalArguments; | 74 return _positionalArguments; |
75 } | 75 } |
76 | 76 |
77 Map<Symbol, dynamic> get namedArguments { | 77 Map<Symbol, dynamic> get namedArguments { |
78 if (_namedArguments == null) { | 78 if (_namedArguments == null) { |
79 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver. | 79 int numArguments = _argumentsDescriptor[0] - 1; // Exclude receiver. |
80 int numPositionalArguments = _argumentsDescriptor[1] - 1; | 80 int numPositionalArguments = _argumentsDescriptor[1] - 1; |
81 int numNamedArguments = numArguments - numPositionalArguments; | 81 int numNamedArguments = numArguments - numPositionalArguments; |
82 if (numNamedArguments == 0) { | 82 if (numNamedArguments == 0) { |
83 return _namedArguments = const <Symbol, dynamic>{}; | 83 return _namedArguments = const {}; |
84 } | 84 } |
85 _namedArguments = new Map<Symbol, dynamic>(); | 85 _namedArguments = new Map<Symbol, dynamic>(); |
86 for (int i = 0; i < numNamedArguments; i++) { | 86 for (int i = 0; i < numNamedArguments; i++) { |
87 String arg_name = _argumentsDescriptor[2 + 2*i]; | 87 String arg_name = _argumentsDescriptor[2 + 2*i]; |
88 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]]; | 88 var arg_value = _arguments[_argumentsDescriptor[3 + 2*i]]; |
89 _namedArguments[new internal.Symbol.unvalidated(arg_name)] = | 89 _namedArguments[new internal.Symbol.unvalidated(arg_name)] = |
90 arg_value; | 90 arg_value; |
91 } | 91 } |
92 _namedArguments = new Map.unmodifiable(_namedArguments); | 92 _namedArguments = new Map.unmodifiable(_namedArguments); |
93 } | 93 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 static _allocateInvocationMirror(String functionName, | 130 static _allocateInvocationMirror(String functionName, |
131 List argumentsDescriptor, | 131 List argumentsDescriptor, |
132 List arguments, | 132 List arguments, |
133 bool isSuperInvocation) { | 133 bool isSuperInvocation) { |
134 return new _InvocationMirror(functionName, | 134 return new _InvocationMirror(functionName, |
135 argumentsDescriptor, | 135 argumentsDescriptor, |
136 arguments, | 136 arguments, |
137 isSuperInvocation); | 137 isSuperInvocation); |
138 } | 138 } |
139 } | 139 } |
OLD | NEW |