OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.call_structure; | 5 library dart2js.call_structure; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart' show Names; | 8 import '../common/names.dart' show Names; |
9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
10 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
11 import '../util/util.dart'; | 11 import '../util/util.dart'; |
12 import 'selector.dart' show Selector; | 12 import 'selector.dart' show Selector; |
13 | 13 |
14 /// The structure of the arguments at a call-site. | 14 /// The structure of the arguments at a call-site. |
15 // TODO(johnniwinther): Should these be cached? | 15 // TODO(johnniwinther): Should these be cached? |
16 // TODO(johnniwinther): Should isGetter/isSetter be part of the call structure | 16 // TODO(johnniwinther): Should isGetter/isSetter be part of the call structure |
17 // instead of the selector? | 17 // instead of the selector? |
18 class CallStructure { | 18 class CallStructure { |
19 static const CallStructure NO_ARGS = const CallStructure.unnamed(0); | 19 static const CallStructure NO_ARGS = const CallStructure.unnamed(0); |
20 static const CallStructure ONE_ARG = const CallStructure.unnamed(1); | 20 static const CallStructure ONE_ARG = const CallStructure.unnamed(1); |
21 static const CallStructure TWO_ARGS = const CallStructure.unnamed(2); | 21 static const CallStructure TWO_ARGS = const CallStructure.unnamed(2); |
| 22 static const CallStructure THREE_ARGS = const CallStructure.unnamed(3); |
22 | 23 |
23 /// The numbers of arguments of the call. Includes named arguments. | 24 /// The numbers of arguments of the call. Includes named arguments. |
24 final int argumentCount; | 25 final int argumentCount; |
25 | 26 |
26 /// The number of named arguments of the call. | 27 /// The number of named arguments of the call. |
27 int get namedArgumentCount => 0; | 28 int get namedArgumentCount => 0; |
28 | 29 |
29 /// The number of positional argument of the call. | 30 /// The number of positional argument of the call. |
30 int get positionalArgumentCount => argumentCount; | 31 int get positionalArgumentCount => argumentCount; |
31 | 32 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 return first.compareTo(second); | 281 return first.compareTo(second); |
281 }); | 282 }); |
282 return _orderedNamedArguments; | 283 return _orderedNamedArguments; |
283 } | 284 } |
284 | 285 |
285 @override | 286 @override |
286 String structureToString() { | 287 String structureToString() { |
287 return 'arity=$argumentCount, named=[${namedArguments.join(', ')}]'; | 288 return 'arity=$argumentCount, named=[${namedArguments.join(', ')}]'; |
288 } | 289 } |
289 } | 290 } |
OLD | NEW |