[analysis_server] Remove useLineEndingsForPlatform
Nobody sets this variable anymore. Any tests going through shared helpers that use `normalizeSource()` are always normalized now.
Change-Id: Idfe3b6430453ad2f92bee950b7a0d60c4a74d135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/444281
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 7ac510d..6132109 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -33,9 +33,6 @@
static final ByteStore _byteStore = MemoryByteStore();
- /// Whether to rewrite line endings in test code based on platform.
- bool useLineEndingsForPlatform = true;
-
final Map<String, String> _declaredVariables = {};
AnalysisContextCollectionImpl? _analysisContextCollection;
@@ -203,9 +200,8 @@
}
/// Convenience function to normalize newlines in [code] for the current
- /// platform if [useLineEndingsForPlatform] is `true`.
- String normalizeSource(String code) =>
- useLineEndingsForPlatform ? normalizeNewlinesForPlatform(code) : code;
+ /// platform.
+ String normalizeSource(String code) => normalizeNewlinesForPlatform(code);
Future<AnalysisSession> sessionFor(File file) async {
var analysisContext = _contextFor(file);
diff --git a/pkg/analyzer/lib/src/test_utilities/platform.dart b/pkg/analyzer/lib/src/test_utilities/platform.dart
index bc11394..ab7b14e 100644
--- a/pkg/analyzer/lib/src/test_utilities/platform.dart
+++ b/pkg/analyzer/lib/src/test_utilities/platform.dart
@@ -12,6 +12,8 @@
// existing `TEST_ANALYZER_WINDOWS_PATHS` var) to allow testing
// `\n` on Windows or `\r\n` on non-Windows, to ensure we don't have any
// code just assuming the platform EOL (instead of the files EOL).
+ // [normalizeNewlinesForPlatform] may need updating to not assume it only
+ // needs to run for Windows.
Platform.lineTerminator;
/// Normalizes content to use platform-specific newlines.
@@ -19,8 +21,7 @@
/// This ensures that when running on Windows, '\r\n' is used, even though
/// source files are checked out using '\n'.
String normalizeNewlinesForPlatform(String input) {
- // TODO(dantup): Once all instances of useLineEndingsForPlatform have been
- // removed, we should try to minimize the number of explicit calls here from
+ // TODO(dantup): Try to minimize the number of explicit calls here from
// tests and have them automatically normalized.
// Skip normalising for other platforms, as the 'gitattributes' for the Dart