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 library elements; | 5 library elements; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 } | 1099 } |
1100 | 1100 |
1101 abstract class FunctionSignature { | 1101 abstract class FunctionSignature { |
1102 FunctionType get type; | 1102 FunctionType get type; |
1103 List<FormalElement> get requiredParameters; | 1103 List<FormalElement> get requiredParameters; |
1104 List<FormalElement> get optionalParameters; | 1104 List<FormalElement> get optionalParameters; |
1105 | 1105 |
1106 int get requiredParameterCount; | 1106 int get requiredParameterCount; |
1107 int get optionalParameterCount; | 1107 int get optionalParameterCount; |
1108 bool get optionalParametersAreNamed; | 1108 bool get optionalParametersAreNamed; |
1109 FormalElement get firstOptionalParameter; | |
1110 bool get hasOptionalParameters; | 1109 bool get hasOptionalParameters; |
1111 | 1110 |
1112 int get parameterCount; | 1111 int get parameterCount; |
1113 List<FormalElement> get orderedOptionalParameters; | 1112 List<FormalElement> get orderedOptionalParameters; |
1114 | 1113 |
1115 void forEachParameter(void function(FormalElement parameter)); | 1114 void forEachParameter(void function(FormalElement parameter)); |
1116 void forEachRequiredParameter(void function(FormalElement parameter)); | 1115 void forEachRequiredParameter(void function(FormalElement parameter)); |
1117 void forEachOptionalParameter(void function(FormalElement parameter)); | 1116 void forEachOptionalParameter(void function(FormalElement parameter)); |
1118 | 1117 |
1119 void orderedForEachParameter(void function(FormalElement parameter)); | 1118 void orderedForEachParameter(void function(FormalElement parameter)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 | 1188 |
1190 /// Is `true` if this marker defines the function body to have a plural | 1189 /// Is `true` if this marker defines the function body to have a plural |
1191 /// result, that is, either an [Iterable] or a [Stream]. | 1190 /// result, that is, either an [Iterable] or a [Stream]. |
1192 final bool isYielding; | 1191 final bool isYielding; |
1193 | 1192 |
1194 const AsyncMarker._({this.isAsync: false, this.isYielding: false}); | 1193 const AsyncMarker._({this.isAsync: false, this.isYielding: false}); |
1195 | 1194 |
1196 String toString() { | 1195 String toString() { |
1197 return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}'; | 1196 return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}'; |
1198 } | 1197 } |
| 1198 |
| 1199 /// Canonical list of marker values. |
| 1200 /// |
| 1201 /// Added to make [AsyncMarker] enum-like. |
| 1202 static const List<AsyncMarker> values = |
| 1203 const <AsyncMarker>[SYNC, SYNC_STAR, ASYNC, ASYNC_STAR]; |
| 1204 |
| 1205 |
| 1206 /// Index to this marker within [values]. |
| 1207 /// |
| 1208 /// Added to make [AsyncMarker] enum-like. |
| 1209 int get index => values.indexOf(this); |
1199 } | 1210 } |
1200 | 1211 |
1201 /// A top level, static or instance function. | 1212 /// A top level, static or instance function. |
1202 abstract class MethodElement extends FunctionElement implements MemberElement {} | 1213 abstract class MethodElement extends FunctionElement implements MemberElement {} |
1203 | 1214 |
1204 /// A local function or closure (anonymous local function). | 1215 /// A local function or closure (anonymous local function). |
1205 abstract class LocalFunctionElement extends FunctionElement | 1216 abstract class LocalFunctionElement extends FunctionElement |
1206 implements LocalElement {} | 1217 implements LocalElement {} |
1207 | 1218 |
1208 /// A constructor. | 1219 /// A constructor. |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 /// by a field. | 1776 /// by a field. |
1766 bool get isDeclaredByField; | 1777 bool get isDeclaredByField; |
1767 | 1778 |
1768 /// Returns `true` if this member is abstract. | 1779 /// Returns `true` if this member is abstract. |
1769 bool get isAbstract; | 1780 bool get isAbstract; |
1770 | 1781 |
1771 /// If abstract, [implementation] points to the overridden concrete member, | 1782 /// If abstract, [implementation] points to the overridden concrete member, |
1772 /// if any. Otherwise [implementation] points to the member itself. | 1783 /// if any. Otherwise [implementation] points to the member itself. |
1773 Member get implementation; | 1784 Member get implementation; |
1774 } | 1785 } |
OLD | NEW |