Index: packages/source_span/lib/src/file.dart |
diff --git a/packages/source_span/lib/src/file.dart b/packages/source_span/lib/src/file.dart |
index 37790ce9296b8d8a31104373a422e36e22841aa9..0217c2d43aaaea3b79df87cfbbc14d7f3d11ac79 100644 |
--- a/packages/source_span/lib/src/file.dart |
+++ b/packages/source_span/lib/src/file.dart |
@@ -2,8 +2,6 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-library source_span.file; |
- |
import 'dart:math' as math; |
import 'dart:typed_data'; |
@@ -51,15 +49,28 @@ class SourceFile { |
/// previous result. |
int _cachedLine; |
- /// Creates a new source file from [text]. |
+ /// This constructor is deprecated. |
/// |
- /// [url] may be either a [String], a [Uri], or `null`. |
+ /// Use [new SourceFile.fromString] instead. |
+ @Deprecated("Will be removed in 2.0.0") |
SourceFile(String text, {url}) |
: this.decoded(text.runes, url: url); |
- /// Creates a new source file from a list of decoded characters. |
+ /// Creates a new source file from [text]. |
+ /// |
+ /// [url] may be either a [String], a [Uri], or `null`. |
+ SourceFile.fromString(String text, {url}) |
+ : this.decoded(text.codeUnits, url: url); |
+ |
+ /// Creates a new source file from a list of decoded code units. |
/// |
/// [url] may be either a [String], a [Uri], or `null`. |
+ /// |
+ /// Currently, if [decodedChars] contains characters larger than `0xFFFF`, |
+ /// they'll be treated as single characters rather than being split into |
+ /// surrogate pairs. **This behavior is deprecated**. For |
+ /// forwards-compatibility, callers should only pass in characters less than |
+ /// or equal to `0xFFFF`. |
SourceFile.decoded(Iterable<int> decodedChars, {url}) |
: url = url is String ? Uri.parse(url) : url, |
_decodedChars = new Uint32List.fromList(decodedChars.toList()) { |