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

Unified Diff: dart/lib/compiler/implementation/scanner/array_based_scanner.dart

Issue 10544173: Update partial parser and scanner to be able to skip expressions like "new Map<S, T>()". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments and add comments 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
Index: dart/lib/compiler/implementation/scanner/array_based_scanner.dart
diff --git a/dart/lib/compiler/implementation/scanner/array_based_scanner.dart b/dart/lib/compiler/implementation/scanner/array_based_scanner.dart
index c3dfb5fc88c9dc003feef2910cb4624222f45dfa..5e15bb5673497d3282e8f97428967eef5a92cd6a 100644
--- a/dart/lib/compiler/implementation/scanner/array_based_scanner.dart
+++ b/dart/lib/compiler/implementation/scanner/array_based_scanner.dart
@@ -49,6 +49,10 @@ class ArrayBasedScanner<S extends SourceString> extends AbstractScanner<S> {
}
void appendKeywordToken(Keyword keyword) {
+ String syntax = keyword.syntax;
+
+ // Type parameters and arguments cannot contain 'this' or 'super'.
+ if (syntax === 'this' || syntax === 'super') discardOpenLt();
tail.next = new KeywordToken(keyword, tokenStart);
tail = tail.next;
}
@@ -90,11 +94,7 @@ class ArrayBasedScanner<S extends SourceString> extends AbstractScanner<S> {
Token token = new BeginGroupToken(info, value, tokenStart);
tail.next = token;
tail = tail.next;
- while (info.kind !== LT_TOKEN &&
- !groupingStack.isEmpty() &&
- groupingStack.head.kind === LT_TOKEN) {
- groupingStack = groupingStack.tail;
- }
+ if (info.kind !== LT_TOKEN) discardOpenLt();
groupingStack = groupingStack.prepend(token);
}

Powered by Google App Engine
This is Rietveld 408576698