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

Unified Diff: pkg/front_end/lib/src/scanner/token.dart

Issue 2915093002: improve fasta unterminated string recovery (Closed)
Patch Set: fix dartdoc Created 3 years, 7 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/front_end/lib/src/scanner/token.dart
diff --git a/pkg/front_end/lib/src/scanner/token.dart b/pkg/front_end/lib/src/scanner/token.dart
index c4ce6f1e55239614c0f56350ba96ea2f8e7fc2b3..c208c134da19df03cbc4634aaa7f14a5b1a36bef 100644
--- a/pkg/front_end/lib/src/scanner/token.dart
+++ b/pkg/front_end/lib/src/scanner/token.dart
@@ -716,17 +716,23 @@ class SyntheticKeywordToken extends KeywordToken {
* A token whose value is independent of it's type.
*/
class SyntheticStringToken extends StringToken {
+ final int _length;
+
/**
* Initialize a newly created token to represent a token of the given [type]
- * with the given [value] at the given [offset].
+ * with the given [value] at the given [offset]. If the [length] is
+ * not specified, then it defaults to the length of [value].
*/
- SyntheticStringToken(TokenType type, String value, int offset)
+ SyntheticStringToken(TokenType type, String value, int offset, [this._length])
: super(type, value, offset);
@override
bool get isSynthetic => true;
@override
+ int get length => _length ?? super.length;
+
+ @override
Token copy() => new SyntheticStringToken(type, _value, offset);
}

Powered by Google App Engine
This is Rietveld 408576698