@@ -15,6 +15,8 @@ import 'package:_fe_analyzer_shared/src/util/colors.dart' as colors;
1515
1616import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity;
1717
18+ import 'package:compiler/src/kernel/dart2js_target.dart' show Dart2jsTarget;
19+
1820import "package:dev_compiler/src/kernel/target.dart" show DevCompilerTarget;
1921
2022import 'package:expect/expect.dart' show Expect;
@@ -32,7 +34,7 @@ import 'package:front_end/src/base/processed_options.dart'
3234 show ProcessedOptions;
3335
3436import 'package:front_end/src/compute_platform_binaries_location.dart'
35- show computePlatformBinariesLocation;
37+ show computePlatformBinariesLocation, computePlatformDillName ;
3638
3739import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
3840
@@ -213,7 +215,8 @@ class RunCompilations extends Step<TestData, TestData, Context> {
213215 "target" ,
214216 "forceLateLoweringForTesting" ,
215217 "trackWidgetCreation" ,
216- "incrementalSerialization"
218+ "incrementalSerialization" ,
219+ "nnbdMode" ,
217220 ]);
218221 result = await new NewWorldTest ().newWorldTest (
219222 data,
@@ -225,6 +228,7 @@ class RunCompilations extends Step<TestData, TestData, Context> {
225228 map["forceLateLoweringForTesting" ] ?? false ,
226229 map["trackWidgetCreation" ] ?? false ,
227230 map["incrementalSerialization" ],
231+ map["nnbdMode" ] == "strong" ? NnbdMode .Strong : NnbdMode .Weak ,
228232 );
229233 break ;
230234 default :
@@ -390,28 +394,35 @@ class NewWorldTest {
390394 String targetName,
391395 bool forceLateLoweringForTesting,
392396 bool trackWidgetCreation,
393- bool incrementalSerialization) async {
397+ bool incrementalSerialization,
398+ NnbdMode nnbdMode) async {
394399 final Uri sdkRoot = computePlatformBinariesLocation (forceBuildDir: true );
395400
396401 TargetFlags targetFlags = new TargetFlags (
397402 forceLateLoweringsForTesting:
398403 forceLateLoweringForTesting ? LateLowering .all : LateLowering .none,
399404 trackWidgetCreation: trackWidgetCreation);
400405 Target target = new VmTarget (targetFlags);
401- String sdkSummary = "vm_platform_strong.dill" ;
402406 if (targetName != null ) {
403407 if (targetName == "None" ) {
404408 target = new NoneTarget (targetFlags);
405409 } else if (targetName == "DDC" ) {
406410 target = new DevCompilerTarget (targetFlags);
407- sdkSummary = "ddc_platform.dill" ;
411+ } else if (targetName == "dart2js" ) {
412+ target = new Dart2jsTarget ("dart2js" , targetFlags);
408413 } else if (targetName == "VM" ) {
409414 // default.
410415 } else {
411416 throw "Unknown target name '$targetName '" ;
412417 }
413418 }
414419
420+ String sdkSummary = computePlatformDillName (
421+ target,
422+ nnbdMode,
423+ () => throw new UnsupportedError (
424+ "No platform dill for target '${targetName }' with $nnbdMode ." ));
425+
415426 final Uri base = Uri .parse ("org-dartlang-test:///" );
416427 final Uri sdkSummaryUri = base .resolve (sdkSummary);
417428 final Uri initializeFrom = base .resolve ("initializeFrom.dill" );
@@ -525,6 +536,7 @@ class NewWorldTest {
525536
526537 if (brandNewWorld) {
527538 options = getOptions (target: target, sdkSummary: sdkSummary);
539+ options.nnbdMode = nnbdMode;
528540 options.fileSystem = fs;
529541 options.sdkRoot = null ;
530542 options.sdkSummary = sdkSummaryUri;
@@ -549,6 +561,8 @@ class NewWorldTest {
549561 ExperimentalFlag .nonNullable: false
550562 };
551563 }
564+ // A separate "world" can also change nnbd mode ---
565+ // notice that the platform is not updated though!
552566 if (world["nnbdMode" ] != null ) {
553567 String nnbdMode = world["nnbdMode" ];
554568 switch (nnbdMode) {
0 commit comments