@@ -49,15 +49,28 @@ class SourceFile {
49
49
/// previous result.
50
50
int _cachedLine;
51
51
52
- /// Creates a new source file from [text] .
52
+ /// This constructor is deprecated .
53
53
///
54
- /// [url] may be either a [String] , a [Uri] , or `null` .
54
+ /// Use [new SourceFile.fromString] instead.
55
+ @Deprecated ("Will be removed in 2.0.0" )
55
56
SourceFile (String text, {url})
56
57
: this .decoded (text.runes, url: url);
57
58
58
- /// Creates a new source file from a list of decoded characters .
59
+ /// Creates a new source file from [text] .
59
60
///
60
61
/// [url] may be either a [String] , a [Uri] , or `null` .
62
+ SourceFile .fromString (String text, {url})
63
+ : this .decoded (text.codeUnits, url: url);
64
+
65
+ /// Creates a new source file from a list of decoded code units.
66
+ ///
67
+ /// [url] may be either a [String] , a [Uri] , or `null` .
68
+ ///
69
+ /// Currently, if [decodedChars] contains characters larger than `0xFFFF` ,
70
+ /// they'll be treated as single characters rather than being split into
71
+ /// surrogate pairs. **This behavior is deprecated**. For
72
+ /// forwards-compatibility, callers should only pass in characters less than
73
+ /// or equal to `0xFFFF` .
61
74
SourceFile .decoded (Iterable <int > decodedChars, {url})
62
75
: url = url is String ? Uri .parse (url) : url,
63
76
_decodedChars = new Uint32List .fromList (decodedChars.toList ()) {
0 commit comments