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 '../constants/constructors.dart'; | 9 import '../constants/constructors.dart'; |
10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
11 import '../common_elements.dart' show CommonElements; | 11 import '../common_elements.dart' show CommonElements; |
12 import '../ordered_typeset.dart' show OrderedTypeSet; | 12 import '../ordered_typeset.dart' show OrderedTypeSet; |
13 import '../resolution/scope.dart' show Scope; | 13 import '../resolution/scope.dart' show Scope; |
14 import '../resolution/tree_elements.dart' show TreeElements; | 14 import '../resolution/tree_elements.dart' show TreeElements; |
15 import '../script.dart'; | 15 import '../script.dart'; |
16 import 'package:front_end/src/fasta/scanner.dart' | 16 import 'package:front_end/src/fasta/scanner.dart' |
17 show Token, isUserDefinableOperator, isMinusOperator; | 17 show Token, isUserDefinableOperator, isMinusOperator; |
18 import '../tree/tree.dart' hide AsyncModifier; | 18 import '../tree/tree.dart' hide AsyncModifier; |
19 import '../universe/call_structure.dart'; | 19 import '../universe/call_structure.dart'; |
20 import '../util/util.dart'; | 20 import '../util/util.dart'; |
21 import '../world.dart' show ClosedWorld; | 21 import '../world.dart' show ClosedWorld; |
22 import 'entities.dart'; | 22 import 'entities.dart'; |
23 import 'entity_utils.dart' as utils; | 23 import 'entity_utils.dart' as utils; |
| 24 import 'jumps.dart'; |
24 import 'names.dart'; | 25 import 'names.dart'; |
25 import 'resolution_types.dart'; | 26 import 'resolution_types.dart'; |
26 import 'types.dart'; | 27 import 'types.dart'; |
27 import 'visitor.dart' show ElementVisitor; | 28 import 'visitor.dart' show ElementVisitor; |
28 | 29 |
29 const int STATE_NOT_STARTED = 0; | 30 const int STATE_NOT_STARTED = 0; |
30 const int STATE_STARTED = 1; | 31 const int STATE_STARTED = 1; |
31 const int STATE_DONE = 2; | 32 const int STATE_DONE = 2; |
32 | 33 |
33 class ElementCategory { | 34 class ElementCategory { |
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 | 1602 |
1602 /// An enum constant value. | 1603 /// An enum constant value. |
1603 abstract class EnumConstantElement extends FieldElement { | 1604 abstract class EnumConstantElement extends FieldElement { |
1604 /// The enum that declared this constant. | 1605 /// The enum that declared this constant. |
1605 EnumClassElement get enclosingClass; | 1606 EnumClassElement get enclosingClass; |
1606 | 1607 |
1607 /// The index of this constant within the values of the enum. | 1608 /// The index of this constant within the values of the enum. |
1608 int get index; | 1609 int get index; |
1609 } | 1610 } |
1610 | 1611 |
1611 /// The label entity defined by a labeled statement. | |
1612 abstract class LabelDefinition extends Entity { | |
1613 Label get label; | |
1614 String get labelName; | |
1615 JumpTarget get target; | |
1616 | |
1617 bool get isTarget; | |
1618 bool get isBreakTarget; | |
1619 bool get isContinueTarget; | |
1620 | |
1621 void setBreakTarget(); | |
1622 void setContinueTarget(); | |
1623 } | |
1624 | |
1625 /// A jump target is the reference point of a statement or switch-case, | |
1626 /// either by label or as the default target of a break or continue. | |
1627 abstract class JumpTarget extends Local { | |
1628 Node get statement; | |
1629 int get nestingLevel; | |
1630 List<LabelDefinition> get labels; | |
1631 | |
1632 bool get isTarget; | |
1633 bool get isBreakTarget; | |
1634 bool get isContinueTarget; | |
1635 bool get isSwitch; | |
1636 | |
1637 // TODO(kasperl): Try to get rid of these. | |
1638 void set isBreakTarget(bool value); | |
1639 void set isContinueTarget(bool value); | |
1640 | |
1641 LabelDefinition addLabel(Label label, String labelName); | |
1642 } | |
1643 | |
1644 /// The [Element] for a type variable declaration on a generic class or typedef. | 1612 /// The [Element] for a type variable declaration on a generic class or typedef. |
1645 abstract class TypeVariableElement extends Element | 1613 abstract class TypeVariableElement extends Element |
1646 implements AstElement, TypedElement, TypeVariableEntity { | 1614 implements AstElement, TypedElement, TypeVariableEntity { |
1647 /// The name of this type variable, taking privacy into account. | 1615 /// The name of this type variable, taking privacy into account. |
1648 Name get memberName; | 1616 Name get memberName; |
1649 | 1617 |
1650 /// Use [typeDeclaration] instead. | 1618 /// Use [typeDeclaration] instead. |
1651 @deprecated | 1619 @deprecated |
1652 get enclosingElement; | 1620 get enclosingElement; |
1653 | 1621 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 /// by a field. | 1865 /// by a field. |
1898 bool get isDeclaredByField; | 1866 bool get isDeclaredByField; |
1899 | 1867 |
1900 /// Returns `true` if this member is abstract. | 1868 /// Returns `true` if this member is abstract. |
1901 bool get isAbstract; | 1869 bool get isAbstract; |
1902 | 1870 |
1903 /// If abstract, [implementation] points to the overridden concrete member, | 1871 /// If abstract, [implementation] points to the overridden concrete member, |
1904 /// if any. Otherwise [implementation] points to the member itself. | 1872 /// if any. Otherwise [implementation] points to the member itself. |
1905 Member get implementation; | 1873 Member get implementation; |
1906 } | 1874 } |
OLD | NEW |