c5cd8ff349
The agnostic mode was added to allow the platform dill embedded in the VM to support both weak and strong mode. Since weak mode is no longer supported in the VM, the agnostic mode can new be deleted. All uses of the agnostic in Dart and Flutter have been removed prior to this change. Change-Id: Iff0f69d9cd64e887e01cd7e7d336a97761bd6d4b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366801 Reviewed-by: Alexander Thomas <athom@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
58 lines
2.0 KiB
Dart
58 lines
2.0 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// 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.
|
|
|
|
import 'utils.dart';
|
|
|
|
/// Test that library flags are serialized and read correctly.
|
|
void main() {
|
|
void setSynthetic(Library lib, bool isSynthetic) {
|
|
lib.isSynthetic = isSynthetic;
|
|
}
|
|
|
|
void verifySynthetic(Library lib, bool isSynthetic) {
|
|
if (lib.isSynthetic != isSynthetic) {
|
|
throw "Serialized and re-read library had change in synthetic flag.";
|
|
}
|
|
}
|
|
|
|
void setNonNullableByDefaultCompiledMode(Library lib,
|
|
NonNullableByDefaultCompiledMode nonNullableByDefaultCompiledMode) {
|
|
lib.nonNullableByDefaultCompiledMode = nonNullableByDefaultCompiledMode;
|
|
}
|
|
|
|
void verifyNonNullableByDefaultCompiledMode(Library lib,
|
|
NonNullableByDefaultCompiledMode nonNullableByDefaultCompiledMode) {
|
|
if (lib.nonNullableByDefaultCompiledMode !=
|
|
nonNullableByDefaultCompiledMode) {
|
|
throw "Serialized and re-read library had change in "
|
|
"nonNullableByDefaultCompiledMode flag.";
|
|
}
|
|
}
|
|
|
|
int combination = 0;
|
|
for (bool isSynthetic in [true, false]) {
|
|
for (NonNullableByDefaultCompiledMode nonNullableByDefaultCompiledMode in [
|
|
NonNullableByDefaultCompiledMode.Weak,
|
|
NonNullableByDefaultCompiledMode.Strong,
|
|
]) {
|
|
combination++;
|
|
print("Checking combination #$combination ("
|
|
"isSynthetic: $isSynthetic; "
|
|
"nonNullableByDefaultCompiledMode:"
|
|
" $nonNullableByDefaultCompiledMode");
|
|
Uri uri = Uri.parse("foo://bar.dart");
|
|
Library lib = new Library(uri, fileUri: uri);
|
|
setSynthetic(lib, isSynthetic);
|
|
setNonNullableByDefaultCompiledMode(
|
|
lib, nonNullableByDefaultCompiledMode);
|
|
Library lib2 = libRoundTrip(lib);
|
|
verifySynthetic(lib2, isSynthetic);
|
|
verifyNonNullableByDefaultCompiledMode(
|
|
lib2, nonNullableByDefaultCompiledMode);
|
|
}
|
|
}
|
|
|
|
print("Done: Everything looks good.");
|
|
}
|