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

Unified Diff: lib/compiler/implementation/resolver.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
Index: lib/compiler/implementation/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index 00d237692cf03a3469fbdf8cc276a67fbd6b9fe7..338148d6de278863f03f569c4f2868a603ce58f1 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -138,7 +138,7 @@ class ResolverTask extends CompilerTask {
resolveRedirectingConstructor(resolver, tree, element, redirection);
}
} else if (tree.initializers != null) {
- error(tree, MessageKind.FUNCTION_WITH_INITIALIZER);
+ error(tree, MessageKind.FUNCTION_WITH_INITIALIZER);
}
visitor.visit(tree.body);
@@ -402,7 +402,7 @@ class InitializerResolver {
final Send call = link.head.asSend();
if (Initializers.isSuperConstructorCall(call)) {
if (resolvedSuper) {
- error(call, MessageKind.DUPLICATE_SUPER_INITIALIZER);
+ error(call, MessageKind.DUPLICATE_SUPER_INITIALIZER);
}
resolveSuperOrThisForSend(constructor, functionNode, call);
resolvedSuper = true;
@@ -1238,7 +1238,7 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
}
visitLabeledStatement(LabeledStatement node) {
- String labelName = node.label.source.slowToString();
+ String labelName = node.label.slowToString();
LabelElement existingElement = statementScope.lookupLabel(labelName);
if (existingElement !== null) {
warning(node.label, MessageKind.DUPLICATE_LABEL, [labelName]);
@@ -1284,19 +1284,19 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
while (!cases.isEmpty()) {
SwitchCase switchCase = cases.head;
if (switchCase.label !== null) {
- Identifier labelIdentifier = switchCase.label;
- String labelName = labelIdentifier.source.slowToString();
+ Label label = switchCase.label;
+ String labelName = label.slowToString();
LabelElement existingElement = continueLabels[labelName];
if (existingElement !== null) {
// It's an error if the same label occurs twice in the same switch.
- warning(labelIdentifier, MessageKind.DUPLICATE_LABEL, [labelName]);
+ warning(label, MessageKind.DUPLICATE_LABEL, [labelName]);
error(existingElement.label, MessageKind.EXISTING_LABEL, [labelName]);
} else {
// It's only a warning if it shadows another label.
existingElement = statementScope.lookupLabel(labelName);
if (existingElement !== null) {
- warning(labelIdentifier, MessageKind.DUPLICATE_LABEL, [labelName]);
+ warning(label, MessageKind.DUPLICATE_LABEL, [labelName]);
warning(existingElement.label,
MessageKind.EXISTING_LABEL, [labelName]);
}
@@ -1308,11 +1308,11 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
enclosingElement);
mapping[switchCase] = targetElement;
- LabelElement label =
- new LabelElement(labelIdentifier, labelName,
+ LabelElement labelElement =
+ new LabelElement(label, labelName,
targetElement, enclosingElement);
- mapping[labelIdentifier] = label;
- continueLabels[labelName] = label;
+ mapping[label] = labelElement;
+ continueLabels[labelName] = labelElement;
}
cases = cases.tail;
if (switchCase.defaultKeyword !== null && !cases.isEmpty()) {
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698