| 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 | 7 |
| 8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 9 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
| 10 import '../util/util.dart'; | 10 import '../util/util.dart'; |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 /// Trying to access a function signature that has not been computed in | 1130 /// Trying to access a function signature that has not been computed in |
| 1131 /// resolution is an error and calling [computeSignature] covers that error. | 1131 /// resolution is an error and calling [computeSignature] covers that error. |
| 1132 /// This method will go away! | 1132 /// This method will go away! |
| 1133 // TODO(johnniwinther): Rename to `ensureFunctionSignature`. | 1133 // TODO(johnniwinther): Rename to `ensureFunctionSignature`. |
| 1134 @deprecated FunctionSignature computeSignature(Compiler compiler); | 1134 @deprecated FunctionSignature computeSignature(Compiler compiler); |
| 1135 | 1135 |
| 1136 bool get hasFunctionSignature; | 1136 bool get hasFunctionSignature; |
| 1137 | 1137 |
| 1138 /// The type of this function. | 1138 /// The type of this function. |
| 1139 FunctionType get type; | 1139 FunctionType get type; |
| 1140 |
| 1141 /// The synchronous/asynchronous marker on this function. |
| 1142 AsyncMarker get asyncMarker; |
| 1143 } |
| 1144 |
| 1145 /// Enum for the synchronous/asynchronous function body modifiers. |
| 1146 class AsyncMarker { |
| 1147 /// The default function body marker. |
| 1148 static AsyncMarker SYNC = const AsyncMarker._(); |
| 1149 |
| 1150 /// The `sync*` function body marker. |
| 1151 static AsyncMarker SYNC_STAR = const AsyncMarker._(isYielding: true); |
| 1152 |
| 1153 /// The `async` function body marker. |
| 1154 static AsyncMarker ASYNC = const AsyncMarker._(isAsync: true); |
| 1155 |
| 1156 /// The `async*` function body marker. |
| 1157 static AsyncMarker ASYNC_STAR = |
| 1158 const AsyncMarker._(isAsync: true, isYielding: true); |
| 1159 |
| 1160 /// Is `true` if this marker defines the function body to have an |
| 1161 /// asynchronous result, that is, either a [Future] or a [Stream]. |
| 1162 final bool isAsync; |
| 1163 |
| 1164 /// Is `true` if this marker defines the function body to have a plural |
| 1165 /// result, that is, either an [Iterable] or a [Stream]. |
| 1166 final bool isYielding; |
| 1167 |
| 1168 const AsyncMarker._({this.isAsync: false, this.isYielding: false}); |
| 1169 |
| 1170 String toString() { |
| 1171 return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}'; |
| 1172 } |
| 1140 } | 1173 } |
| 1141 | 1174 |
| 1142 /// A top level, static or instance function. | 1175 /// A top level, static or instance function. |
| 1143 abstract class MethodElement extends FunctionElement | 1176 abstract class MethodElement extends FunctionElement |
| 1144 implements MemberElement { | 1177 implements MemberElement { |
| 1145 } | 1178 } |
| 1146 | 1179 |
| 1147 /// A local function or closure (anonymous local function). | 1180 /// A local function or closure (anonymous local function). |
| 1148 abstract class LocalFunctionElement extends FunctionElement | 1181 abstract class LocalFunctionElement extends FunctionElement |
| 1149 implements LocalElement { | 1182 implements LocalElement { |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 bool get isDeclaredByField; | 1602 bool get isDeclaredByField; |
| 1570 | 1603 |
| 1571 /// Returns `true` if this member is abstract. | 1604 /// Returns `true` if this member is abstract. |
| 1572 bool get isAbstract; | 1605 bool get isAbstract; |
| 1573 | 1606 |
| 1574 /// If abstract, [implementation] points to the overridden concrete member, | 1607 /// If abstract, [implementation] points to the overridden concrete member, |
| 1575 /// if any. Otherwise [implementation] points to the member itself. | 1608 /// if any. Otherwise [implementation] points to the member itself. |
| 1576 Member get implementation; | 1609 Member get implementation; |
| 1577 } | 1610 } |
| 1578 | 1611 |
| OLD | NEW |