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

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartParser.java

Issue 10692080: Add unit tests for ParserErrorCode values (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/parser/DartParser.java
diff --git a/compiler/java/com/google/dart/compiler/parser/DartParser.java b/compiler/java/com/google/dart/compiler/parser/DartParser.java
index 8f9cfc073c9092218ec737af748ef623822d71a5..e8dc6a33b711e7c8ade636b7bb88a62ed7c21c5d 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -3117,7 +3117,7 @@ public class DartParser extends CompletionHooksParserBase {
constructor = doneWithoutConsuming(toPrefixedType(parts));
} else {
// Named constructor.
- DartIdentifier identifier = ensureIdentifier(part2);
+ DartIdentifier identifier = (DartIdentifier)part2.getIdentifier();
constructor = doneWithoutConsuming(new DartPropertyAccess(doneWithoutConsuming(part1),
identifier));
}
@@ -3129,7 +3129,7 @@ public class DartParser extends CompletionHooksParserBase {
reportError(parts.get(3), ParserErrorCode.EXPECTED_LEFT_PAREN);
}
DartTypeNode typeNode = doneWithoutConsuming(toPrefixedType(parts));
- DartIdentifier identifier = ensureIdentifier(parts.get(2));
+ DartIdentifier identifier = (DartIdentifier)parts.get(2).getIdentifier();
constructor = doneWithoutConsuming(new DartPropertyAccess(typeNode, identifier));
break;
}
@@ -3144,16 +3144,8 @@ public class DartParser extends CompletionHooksParserBase {
}
}
- private DartIdentifier ensureIdentifier(DartTypeNode node) {
- List<DartTypeNode> typeArguments = node.getTypeArguments();
- if (!typeArguments.isEmpty()) {
- reportError(typeArguments.get(0), ParserErrorCode.UNEXPECTED_TYPE_ARGUMENT);
- }
- return (DartIdentifier) node.getIdentifier();
- }
-
private DartTypeNode toPrefixedType(List<DartTypeNode> parts) {
- DartIdentifier part1 = ensureIdentifier(parts.get(0));
+ DartIdentifier part1 = (DartIdentifier)parts.get(0).getIdentifier();
DartTypeNode part2 = parts.get(1);
DartIdentifier identifier = (DartIdentifier) part2.getIdentifier();
DartPropertyAccess access = doneWithoutConsuming(new DartPropertyAccess(part1, identifier));
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/parser/ParserErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698