| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.jumps; | 5 library elements.jumps; |
| 6 | 6 |
| 7 import 'entities.dart'; | 7 import 'entities.dart'; |
| 8 | 8 |
| 9 /// The label entity defined by a labeled statement. | 9 /// The label entity defined by a labeled statement. |
| 10 abstract class LabelDefinition<T> extends Entity { | 10 abstract class LabelDefinition<T> extends Entity { |
| 11 T get label; | 11 T get label; |
| 12 String get labelName; | 12 String get labelName; |
| 13 JumpTarget<T> get target; | 13 JumpTarget<T> get target; |
| 14 | 14 |
| 15 bool get isTarget; | 15 bool get isTarget => isBreakTarget || isContinueTarget; |
| 16 |
| 16 bool get isBreakTarget; | 17 bool get isBreakTarget; |
| 17 bool get isContinueTarget; | 18 bool get isContinueTarget; |
| 18 } | 19 } |
| 19 | 20 |
| 20 /// A jump target is the reference point of a statement or switch-case, | 21 /// A jump target is the reference point of a statement or switch-case, |
| 21 /// either by label or as the default target of a break or continue. | 22 /// either by label or as the default target of a break or continue. |
| 22 abstract class JumpTarget<T> extends Local { | 23 abstract class JumpTarget<T> extends Local { |
| 24 String get name => 'target'; |
| 25 |
| 26 bool get isTarget => isBreakTarget || isContinueTarget; |
| 27 |
| 23 T get statement; | 28 T get statement; |
| 24 int get nestingLevel; | 29 int get nestingLevel; |
| 25 List<LabelDefinition<T>> get labels; | 30 List<LabelDefinition<T>> get labels; |
| 26 | 31 |
| 27 bool get isTarget; | |
| 28 bool get isBreakTarget; | 32 bool get isBreakTarget; |
| 29 bool get isContinueTarget; | 33 bool get isContinueTarget; |
| 30 bool get isSwitch; | 34 bool get isSwitch; |
| 31 | 35 |
| 32 LabelDefinition<T> addLabel(covariant T label, String labelName, | 36 LabelDefinition<T> addLabel(covariant T label, String labelName, |
| 33 {bool isBreakTarget: false}); | 37 {bool isBreakTarget: false}); |
| 34 } | 38 } |
| OLD | NEW |