OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library entities; | 5 library entities; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../universe/call_structure.dart' show CallStructure; |
8 | 9 |
9 /// Abstract interface for entities. | 10 /// Abstract interface for entities. |
10 /// | 11 /// |
11 /// Implement this directly if the entity is not a Dart language entity. | 12 /// Implement this directly if the entity is not a Dart language entity. |
12 /// Entities defined within the Dart language should implement [Element]. | 13 /// Entities defined within the Dart language should implement [Element]. |
13 /// | 14 /// |
14 /// For instance, the JavaScript backend need to create synthetic variables for | 15 /// For instance, the JavaScript backend need to create synthetic variables for |
15 /// calling intercepted classes and such variables do not correspond to an | 16 /// calling intercepted classes and such variables do not correspond to an |
16 /// entity in the Dart source code nor in the terminology of the Dart language | 17 /// entity in the Dart source code nor in the terminology of the Dart language |
17 /// and should therefore implement [Entity] directly. | 18 /// and should therefore implement [Entity] directly. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 const ParameterStructure( | 177 const ParameterStructure( |
177 this.requiredParameters, this.positionalParameters, this.namedParameters); | 178 this.requiredParameters, this.positionalParameters, this.namedParameters); |
178 | 179 |
179 const ParameterStructure.getter() : this(0, 0, const <String>[]); | 180 const ParameterStructure.getter() : this(0, 0, const <String>[]); |
180 | 181 |
181 const ParameterStructure.setter() : this(1, 1, const <String>[]); | 182 const ParameterStructure.setter() : this(1, 1, const <String>[]); |
182 | 183 |
183 /// The number of optional parameters (positional or named). | 184 /// The number of optional parameters (positional or named). |
184 int get optionalParameters => | 185 int get optionalParameters => |
185 positionalParameters - requiredParameters + namedParameters.length; | 186 positionalParameters - requiredParameters + namedParameters.length; |
| 187 |
| 188 /// Returns the [CallStructure] corresponding to a call site passing all |
| 189 /// parameters both required and optional. |
| 190 CallStructure get callStructure { |
| 191 return new CallStructure( |
| 192 positionalParameters + namedParameters.length, namedParameters); |
| 193 } |
186 } | 194 } |
OLD | NEW |