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

Unified Diff: pkg/analyzer_experimental/lib/src/generated/scanner.dart

Issue 27278004: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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: pkg/analyzer_experimental/lib/src/generated/scanner.dart
diff --git a/pkg/analyzer_experimental/lib/src/generated/scanner.dart b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
index b255e75d7b462164bfc0e276b4b00e0b57aaac7c..81652aaf92930cf65f04a8cea21e147bfa88ebe9 100644
--- a/pkg/analyzer_experimental/lib/src/generated/scanner.dart
+++ b/pkg/analyzer_experimental/lib/src/generated/scanner.dart
@@ -427,6 +427,11 @@ abstract class AbstractScanner {
List<BeginToken> _groupingStack = new List<BeginToken>();
/**
+ * The index of the last item in the [groupingStack], or `-1` if the stack is empty.
+ */
+ int _stackEnd = -1;
+
+ /**
* A flag indicating whether any unmatched groups were found during the parse.
*/
bool _hasUnmatchedGroups2 = false;
@@ -535,6 +540,7 @@ abstract class AbstractScanner {
}
_tail = _tail.setNext(token);
_groupingStack.add(token);
+ _stackEnd++;
}
void appendCommentToken(TokenType type, String value) {
if (_firstComment == null) {
@@ -554,12 +560,11 @@ abstract class AbstractScanner {
_lastComment = null;
}
_tail = _tail.setNext(token);
- int last = _groupingStack.length - 1;
- if (last >= 0) {
- BeginToken begin = _groupingStack[last];
+ if (_stackEnd >= 0) {
+ BeginToken begin = _groupingStack[_stackEnd];
if (identical(begin.type, beginType)) {
begin.endToken = token;
- _groupingStack.removeAt(last);
+ _groupingStack.removeAt(_stackEnd--);
}
}
}
@@ -574,7 +579,7 @@ abstract class AbstractScanner {
}
eofToken.setNext(eofToken);
_tail = _tail.setNext(eofToken);
- if (!_groupingStack.isEmpty) {
+ if (_stackEnd >= 0) {
_hasUnmatchedGroups2 = true;
}
}
@@ -775,15 +780,13 @@ abstract class AbstractScanner {
* @return the token to be paired with the closing brace
*/
BeginToken findTokenMatchingClosingBraceInInterpolationExpression() {
- int last = _groupingStack.length - 1;
- while (last >= 0) {
- BeginToken begin = _groupingStack[last];
+ while (_stackEnd >= 0) {
+ BeginToken begin = _groupingStack[_stackEnd];
if (identical(begin.type, TokenType.OPEN_CURLY_BRACKET) || identical(begin.type, TokenType.STRING_INTERPOLATION_EXPRESSION)) {
return begin;
}
_hasUnmatchedGroups2 = true;
- _groupingStack.removeAt(last);
- last--;
+ _groupingStack.removeAt(_stackEnd--);
}
return null;
}
« no previous file with comments | « pkg/analyzer_experimental/lib/src/generated/resolver.dart ('k') | pkg/analyzer_experimental/test/generated/ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698