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

Unified Diff: lib/src/span_scanner.dart

Issue 2056933002: Add breaking changes and release 1.0.0. (Closed) Base URL: git@github.com:dart-lang/string_scanner@master
Patch Set: Created 4 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
« no previous file with comments | « lib/src/line_scanner.dart ('k') | lib/src/string_scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/span_scanner.dart
diff --git a/lib/src/span_scanner.dart b/lib/src/span_scanner.dart
index dd7f0e4f2e261b99b5265c161bdfa8e6e94081ff..043021b4d361b1c58a7ea1fa3b54d8e1cb774952 100644
--- a/lib/src/span_scanner.dart
+++ b/lib/src/span_scanner.dart
@@ -38,7 +38,10 @@ class SpanScanner extends StringScanner implements LineScanner {
///
/// This is the span for the entire match. There's no way to get spans for
/// subgroups since [Match] exposes no information about their positions.
- FileSpan get lastSpan => _lastSpan;
+ FileSpan get lastSpan {
+ if (lastMatch == null) _lastSpan = null;
+ return _lastSpan;
+ }
FileSpan _lastSpan;
/// The current location of the scanner.
@@ -102,7 +105,7 @@ class SpanScanner extends StringScanner implements LineScanner {
if (position == null) {
position = match == null ? this.position : match.start;
}
- if (length == null) length = match == null ? 1 : match.end - match.start;
+ if (length == null) length = match == null ? 0 : match.end - match.start;
var span = _sourceFile.span(position, position + length);
throw new StringScannerException(message, span, string);
« no previous file with comments | « lib/src/line_scanner.dart ('k') | lib/src/string_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698