Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(880)

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10392024: Add a "Label" Node around an Identifier that is being used as a label. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressede review comments. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 35aae1193e7ec007e2c9bf4053842eb8c84c1616..5f879bd72a7791deaf29928a0f94002816631f02 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -985,15 +985,16 @@ class Elements {
class LabelElement extends Element {
- final Identifier label;
+ // We store the original label here so it can be returned by [parseNode].
+ final Label label;
final String labelName;
final TargetElement target;
bool isBreakTarget = false;
bool isContinueTarget = false;
- LabelElement(Identifier label, this.labelName, this.target,
+ LabelElement(Label label, this.labelName, this.target,
Element enclosingElement)
: this.label = label,
- super(label.source, ElementKind.LABEL, enclosingElement);
+ super(label.identifier.source, ElementKind.LABEL, enclosingElement);
void setBreakTarget() {
isBreakTarget = true;
@@ -1007,14 +1008,13 @@ class LabelElement extends Element {
bool get isTarget() => isBreakTarget || isContinueTarget;
Node parseNode(DiagnosticListener l) => label;
- Token position() => label.token;
+ Token position() => label.getBeginToken();
String toString() => "${labelName}:";
}
-// Represents a reference to a statement, either a label or the
+// Represents a reference to a statement or switch-case, either by label or the
// default target of a break or continue.
class TargetElement extends Element {
- // TODO(lrn): StatementElement is not just referencing statements anymore.
final Node statement;
final int nestingLevel;
Link<LabelElement> labels = const EmptyLink<LabelElement>();
@@ -1025,7 +1025,7 @@ class TargetElement extends Element {
: super(const SourceString(""), ElementKind.STATEMENT, enclosingElement);
bool get isTarget() => isBreakTarget || isContinueTarget;
- LabelElement addLabel(Identifier label, String labelName) {
+ LabelElement addLabel(Label label, String labelName) {
LabelElement result = new LabelElement(label, labelName, this,
enclosingElement);
labels = labels.prepend(result);
« no previous file with comments | « no previous file | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698