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

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

Issue 730533003: Code clean-up and minor bug fix (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/test/enum_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/scanner.dart
diff --git a/pkg/analyzer/lib/src/generated/scanner.dart b/pkg/analyzer/lib/src/generated/scanner.dart
index 59aa4b9a813e61307514dda754d3ba645076a302..a12c4eacee318f94aa19b927ca95979a19f82773 100644
--- a/pkg/analyzer/lib/src/generated/scanner.dart
+++ b/pkg/analyzer/lib/src/generated/scanner.dart
@@ -2057,6 +2057,26 @@ class Token {
Token _next;
/**
+ * Compare the given [tokens] to find the token that appears first in the
+ * source being parsed. That is, return the left-most of all of the tokens.
+ * The list must be non-`null`, but the elements of the list are allowed to be
+ * `null`. Return the token with the smallest offset, or `null` if there are
+ * no tokens or if all of the tokens are `null`.
+ */
+ static Token lexicallyFirst(List<Token> tokens) {
+ Token first = null;
+ int offset = -1;
+ for (Token token in tokens) {
+ if (token != null && (offset < 0 || token.offset < offset)) {
+ first = token;
+ offset = token.offset;
+ }
+ }
+ return first;
+ }
+
+
+ /**
* Initialize a newly created token to have the given type and offset.
*
* @param type the type of the token
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/test/enum_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698