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

Unified Diff: sdk/lib/_internal/compiler/implementation/scanner/token.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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: sdk/lib/_internal/compiler/implementation/scanner/token.dart
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/token.dart b/sdk/lib/_internal/compiler/implementation/scanner/token.dart
index 573fc4f8dbc8a8ac8e9357c588cfbb3fb34380fc..b80ca1503a5d006f24fd7fc15a31deba9b329f08 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/token.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/token.dart
@@ -205,7 +205,7 @@ abstract class SourceString extends Iterable<int> {
bool isPrivate();
}
-class StringWrapper implements SourceString {
+class StringWrapper extends Iterable<int> implements SourceString {
final String stringValue;
const StringWrapper(String this.stringValue);
@@ -216,7 +216,7 @@ class StringWrapper implements SourceString {
return other is SourceString && toString() == other.slowToString();
}
- Iterator<int> iterator() => new StringCodeIterator(stringValue);
+ Iterator<int> get iterator => new StringCodeIterator(stringValue);
void printOn(StringBuffer sb) {
sb.add(stringValue);
@@ -243,6 +243,7 @@ class StringCodeIterator implements Iterator<int> {
final String string;
int index;
final int end;
+ int _current;
StringCodeIterator(String string) :
this.string = string, index = 0, end = string.length;
@@ -253,8 +254,14 @@ class StringCodeIterator implements Iterator<int> {
assert(end <= string.length);
}
- bool get hasNext => index < end;
- int next() => string.charCodeAt(index++);
+ int get current => _current;
+
+ bool moveNext() {
+ _current = null;
+ if (index >= end) return false;
+ _current = string.charCodeAt(index++);
+ return true;
+ }
}
class BeginGroupToken extends StringToken {

Powered by Google App Engine
This is Rietveld 408576698