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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java

Issue 18660007: Report EXPECTED_ONE_LIST_TYPE_ARGUMENTS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/ParserErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
index 10eba43552c506063b3206dae25211edd724092e..d7a124ec0db451ce556d6c8db08d3074e4337f17 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
@@ -3571,6 +3571,14 @@ public class Parser {
* @return the list literal that was parsed
*/
private ListLiteral parseListLiteral(Token modifier, TypeArgumentList typeArguments) {
+ // validate number of type arguments
+ if (typeArguments != null) {
+ int num = typeArguments.getArguments().size();
+ if (num != 1) {
+ reportError(ParserErrorCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS, typeArguments, num);
+ }
+ }
+ // may be empty list literal
if (matches(TokenType.INDEX)) {
BeginToken leftBracket = new BeginToken(
TokenType.OPEN_SQUARE_BRACKET,
@@ -3583,6 +3591,7 @@ public class Parser {
currentToken = currentToken.getNext();
return new ListLiteral(modifier, typeArguments, leftBracket, null, rightBracket);
}
+ // open
Token leftBracket = expect(TokenType.OPEN_SQUARE_BRACKET);
if (matches(TokenType.CLOSE_SQUARE_BRACKET)) {
return new ListLiteral(modifier, typeArguments, leftBracket, null, getAndAdvance());
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/ParserErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698