Skip to content

Commit ad138aa

Browse files
davidmorganCommit Queue
authored andcommitted
[analyzer] Remove bazel BUILD-based legacy language version detection.
[email protected] Change-Id: Ie3d93f7f370c9e9ceed671d533f740e3036de054 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339320 Commit-Queue: Keerti Parthasarathy <[email protected]> Auto-Submit: Morgan :) <[email protected]> Reviewed-by: Keerti Parthasarathy <[email protected]>
1 parent 9cf01a3 commit ad138aa

File tree

5 files changed

+1
-244
lines changed

5 files changed

+1
-244
lines changed

pkg/analyzer/lib/src/workspace/blaze.dart

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ class BlazeWorkspacePackage extends WorkspacePackage {
567567
@override
568568
final BlazeWorkspace workspace;
569569

570-
bool _buildFileReady = false;
571570
List<String>? _enabledExperiments;
572571
Version? _languageVersion;
573572

@@ -576,7 +575,6 @@ class BlazeWorkspacePackage extends WorkspacePackage {
576575

577576
@override
578577
List<String>? get enabledExperiments {
579-
_readBuildFile();
580578
return _enabledExperiments;
581579
}
582580

@@ -585,7 +583,6 @@ class BlazeWorkspacePackage extends WorkspacePackage {
585583
if (!workspace._provideLanguageVersion) {
586584
return null;
587585
}
588-
_readBuildFile();
589586
return _languageVersion ?? workspace._languageVersion;
590587
}
591588

@@ -641,32 +638,4 @@ class BlazeWorkspacePackage extends WorkspacePackage {
641638

642639
return false;
643640
}
644-
645-
void _readBuildFile() {
646-
if (_buildFileReady) {
647-
return;
648-
}
649-
650-
try {
651-
_buildFileReady = true;
652-
var buildContent = workspace.provider
653-
.getFolder(root)
654-
.getChildAssumingFile('BUILD')
655-
.readAsStringSync();
656-
var flattenedBuildContent = buildContent
657-
.split('\n')
658-
.map((e) => e.trim())
659-
.where((e) => !e.startsWith('#'))
660-
.map((e) => e.replaceAll(' ', ''))
661-
.join();
662-
var hasLegacyFlag = const {
663-
'dart_package(null_safety=False',
664-
}.any(flattenedBuildContent.contains);
665-
if (hasLegacyFlag) {
666-
_languageVersion = Version.parse('2.9.0');
667-
}
668-
} on FileSystemException {
669-
// ignored
670-
}
671-
}
672641
}

pkg/analyzer/test/src/dart/micro/file_resolution.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,7 @@ class FileResolutionTest with ResourceProviderMixin, ResolutionTest {
145145
);
146146

147147
newFile('/workspace/${file_paths.blazeWorkspaceMarker}', '');
148-
newFile('/workspace/dart/test/BUILD', r'''
149-
dart_package(
150-
null_safety = True,
151-
)
152-
''');
148+
newFile('/workspace/dart/test/BUILD', '');
153149
createFileResolver();
154150
}
155151

pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,23 +1858,6 @@ void f(int? a) {
18581858
);
18591859
}
18601860

1861-
test_nullSafety_notEnabled() async {
1862-
newFile('/workspace/dart/test/BUILD', r'''
1863-
dart_package(null_safety = False)
1864-
''');
1865-
1866-
await assertErrorsInCode(r'''
1867-
void f(int? a) {}
1868-
''', [
1869-
error(ParserErrorCode.EXPERIMENT_NOT_ENABLED, 10, 1),
1870-
]);
1871-
1872-
assertType(
1873-
findElement.parameter('a').type,
1874-
'int*',
1875-
);
1876-
}
1877-
18781861
test_part_notInLibrary_libraryDoesNotExist() async {
18791862
// TODO(scheglov): Should report CompileTimeErrorCode.URI_DOES_NOT_EXIST
18801863
await assertNoErrorsInCode(r'''

pkg/analyzer/test/src/dart/resolution/non_nullable_blaze_workspace_test.dart

Lines changed: 0 additions & 189 deletions
This file was deleted.

pkg/analyzer/test/src/dart/resolution/test_all.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ import 'mixin_test.dart' as mixin_resolution;
7575
import 'named_type_test.dart' as named_type;
7676
import 'namespace_test.dart' as namespace;
7777
import 'node_text_expectations.dart';
78-
import 'non_nullable_blaze_workspace_test.dart' as non_nullable_blaze_workspace;
7978
import 'non_nullable_test.dart' as non_nullable;
8079
import 'null_assert_pattern_test.dart' as null_assert_pattern;
8180
import 'null_check_pattern_test.dart' as null_check_pattern;
@@ -184,7 +183,6 @@ main() {
184183
mixin_resolution.main();
185184
named_type.main();
186185
namespace.main();
187-
non_nullable_blaze_workspace.main();
188186
non_nullable.main();
189187
null_assert_pattern.main();
190188
null_check_pattern.main();

0 commit comments

Comments
 (0)