@@ -49,15 +49,28 @@ class SourceFile {
4949 /// previous result.
5050 int _cachedLine;
5151
52- /// Creates a new source file from [text] .
52+ /// This constructor is deprecated .
5353 ///
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" )
5556 SourceFile (String text, {url})
5657 : this .decoded (text.runes, url: url);
5758
58- /// Creates a new source file from a list of decoded characters .
59+ /// Creates a new source file from [text] .
5960 ///
6061 /// [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` .
6174 SourceFile .decoded (Iterable <int > decodedChars, {url})
6275 : url = url is String ? Uri .parse (url) : url,
6376 _decodedChars = new Uint32List .fromList (decodedChars.toList ()) {
0 commit comments