| 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 'package:front_end/src/fasta/parser/async_modifier.dart' |
| 8 show AsyncModifier; |
| 9 |
| 7 import '../common.dart'; | 10 import '../common.dart'; |
| 8 import '../common/resolution.dart' show Resolution; | 11 import '../common/resolution.dart' show Resolution; |
| 9 import '../constants/constructors.dart'; | 12 import '../constants/constructors.dart'; |
| 10 import '../constants/expressions.dart'; | 13 import '../constants/expressions.dart'; |
| 11 import '../common_elements.dart' show CommonElements; | 14 import '../common_elements.dart' show CommonElements; |
| 12 import '../ordered_typeset.dart' show OrderedTypeSet; | 15 import '../ordered_typeset.dart' show OrderedTypeSet; |
| 13 import '../resolution/scope.dart' show Scope; | 16 import '../resolution/scope.dart' show Scope; |
| 14 import '../resolution/tree_elements.dart' show TreeElements; | 17 import '../resolution/tree_elements.dart' show TreeElements; |
| 15 import '../script.dart'; | 18 import '../script.dart'; |
| 16 import 'package:front_end/src/fasta/scanner.dart' | 19 import 'package:front_end/src/fasta/scanner.dart' |
| 17 show Token, isUserDefinableOperator, isMinusOperator; | 20 show Token, isUserDefinableOperator, isMinusOperator; |
| 18 import '../tree/tree.dart'; | 21 import '../tree/tree.dart' hide AsyncModifier; |
| 19 import '../universe/call_structure.dart'; | 22 import '../universe/call_structure.dart'; |
| 20 import 'package:front_end/src/fasta/scanner/characters.dart' show $_; | 23 import 'package:front_end/src/fasta/scanner/characters.dart' show $_; |
| 21 import '../util/util.dart'; | 24 import '../util/util.dart'; |
| 22 import '../world.dart' show ClosedWorld; | 25 import '../world.dart' show ClosedWorld; |
| 23 import 'entities.dart'; | 26 import 'entities.dart'; |
| 24 import 'resolution_types.dart'; | 27 import 'resolution_types.dart'; |
| 25 import 'visitor.dart' show ElementVisitor; | 28 import 'visitor.dart' show ElementVisitor; |
| 26 | 29 |
| 27 part 'names.dart'; | 30 part 'names.dart'; |
| 28 | 31 |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 | 1333 |
| 1331 /// A setter. | 1334 /// A setter. |
| 1332 abstract class SetterElement extends AccessorElement { | 1335 abstract class SetterElement extends AccessorElement { |
| 1333 /// The getter corresponding to this setter, if any. | 1336 /// The getter corresponding to this setter, if any. |
| 1334 GetterElement get getter; | 1337 GetterElement get getter; |
| 1335 } | 1338 } |
| 1336 | 1339 |
| 1337 /// Enum for the synchronous/asynchronous function body modifiers. | 1340 /// Enum for the synchronous/asynchronous function body modifiers. |
| 1338 class AsyncMarker { | 1341 class AsyncMarker { |
| 1339 /// The default function body marker. | 1342 /// The default function body marker. |
| 1340 static const AsyncMarker SYNC = const AsyncMarker._(); | 1343 static const AsyncMarker SYNC = const AsyncMarker._(AsyncModifier.Sync); |
| 1341 | 1344 |
| 1342 /// The `sync*` function body marker. | 1345 /// The `sync*` function body marker. |
| 1343 static const AsyncMarker SYNC_STAR = const AsyncMarker._(isYielding: true); | 1346 static const AsyncMarker SYNC_STAR = |
| 1347 const AsyncMarker._(AsyncModifier.SyncStar, isYielding: true); |
| 1344 | 1348 |
| 1345 /// The `async` function body marker. | 1349 /// The `async` function body marker. |
| 1346 static const AsyncMarker ASYNC = const AsyncMarker._(isAsync: true); | 1350 static const AsyncMarker ASYNC = |
| 1351 const AsyncMarker._(AsyncModifier.Async, isAsync: true); |
| 1347 | 1352 |
| 1348 /// The `async*` function body marker. | 1353 /// The `async*` function body marker. |
| 1349 static const AsyncMarker ASYNC_STAR = | 1354 static const AsyncMarker ASYNC_STAR = const AsyncMarker._( |
| 1350 const AsyncMarker._(isAsync: true, isYielding: true); | 1355 AsyncModifier.AsyncStar, |
| 1356 isAsync: true, |
| 1357 isYielding: true); |
| 1351 | 1358 |
| 1352 /// Is `true` if this marker defines the function body to have an | 1359 /// Is `true` if this marker defines the function body to have an |
| 1353 /// asynchronous result, that is, either a [Future] or a [Stream]. | 1360 /// asynchronous result, that is, either a [Future] or a [Stream]. |
| 1354 final bool isAsync; | 1361 final bool isAsync; |
| 1355 | 1362 |
| 1356 /// Is `true` if this marker defines the function body to have a plural | 1363 /// Is `true` if this marker defines the function body to have a plural |
| 1357 /// result, that is, either an [Iterable] or a [Stream]. | 1364 /// result, that is, either an [Iterable] or a [Stream]. |
| 1358 final bool isYielding; | 1365 final bool isYielding; |
| 1359 | 1366 |
| 1360 const AsyncMarker._({this.isAsync: false, this.isYielding: false}); | 1367 final AsyncModifier asyncParserState; |
| 1368 |
| 1369 const AsyncMarker._(this.asyncParserState, |
| 1370 {this.isAsync: false, this.isYielding: false}); |
| 1361 | 1371 |
| 1362 String toString() { | 1372 String toString() { |
| 1363 return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}'; | 1373 return '${isAsync ? 'async' : 'sync'}${isYielding ? '*' : ''}'; |
| 1364 } | 1374 } |
| 1365 | 1375 |
| 1366 /// Canonical list of marker values. | 1376 /// Canonical list of marker values. |
| 1367 /// | 1377 /// |
| 1368 /// Added to make [AsyncMarker] enum-like. | 1378 /// Added to make [AsyncMarker] enum-like. |
| 1369 static const List<AsyncMarker> values = const <AsyncMarker>[ | 1379 static const List<AsyncMarker> values = const <AsyncMarker>[ |
| 1370 SYNC, | 1380 SYNC, |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 /// by a field. | 2027 /// by a field. |
| 2018 bool get isDeclaredByField; | 2028 bool get isDeclaredByField; |
| 2019 | 2029 |
| 2020 /// Returns `true` if this member is abstract. | 2030 /// Returns `true` if this member is abstract. |
| 2021 bool get isAbstract; | 2031 bool get isAbstract; |
| 2022 | 2032 |
| 2023 /// If abstract, [implementation] points to the overridden concrete member, | 2033 /// If abstract, [implementation] points to the overridden concrete member, |
| 2024 /// if any. Otherwise [implementation] points to the member itself. | 2034 /// if any. Otherwise [implementation] points to the member itself. |
| 2025 Member get implementation; | 2035 Member get implementation; |
| 2026 } | 2036 } |
| OLD | NEW |