eb956a2516
Fasta can generate synthetic libraries. Previously we didn't include them when serializing, but that leaves references in the binary to libraries that doesn't exist which isn't ideal. This change includes them, and adds a flag to kernel Libraries such that we know they are synthetic. Change-Id: Ied25a21cd1f384d318347021bc7ec18dae3a4e05 Reviewed-on: https://dart-review.googlesource.com/c/91722 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Peter von der Ahé <ahe@google.com>
46 lines
1.7 KiB
Dart
46 lines
1.7 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 (external, synthetic)
|
|
/// are serialized and read correctly.
|
|
main() {
|
|
Library lib = new Library(Uri.parse("foo://bar.dart"));
|
|
lib.isExternal = false;
|
|
lib.isSynthetic = false;
|
|
Library lib2 = libRoundTrip(lib);
|
|
if (lib2.isExternal != false)
|
|
throw "Serialized and re-read library had change in external flag.";
|
|
if (lib2.isSynthetic != false)
|
|
throw "Serialized and re-read library had change in synthetic flag.";
|
|
|
|
lib = new Library(Uri.parse("foo://bar.dart"));
|
|
lib.isExternal = true;
|
|
lib.isSynthetic = false;
|
|
lib2 = libRoundTrip(lib);
|
|
if (lib2.isExternal != true)
|
|
throw "Serialized and re-read library had change in external flag.";
|
|
if (lib2.isSynthetic != false)
|
|
throw "Serialized and re-read library had change in synthetic flag.";
|
|
|
|
lib = new Library(Uri.parse("foo://bar.dart"));
|
|
lib.isExternal = false;
|
|
lib.isSynthetic = true;
|
|
lib2 = libRoundTrip(lib);
|
|
if (lib2.isExternal != false)
|
|
throw "Serialized and re-read library had change in external flag.";
|
|
if (lib2.isSynthetic != true)
|
|
throw "Serialized and re-read library had change in synthetic flag.";
|
|
|
|
lib = new Library(Uri.parse("foo://bar.dart"));
|
|
lib.isExternal = true;
|
|
lib.isSynthetic = true;
|
|
lib2 = libRoundTrip(lib);
|
|
if (lib2.isExternal != true)
|
|
throw "Serialized and re-read library had change in external flag.";
|
|
if (lib2.isSynthetic != true)
|
|
throw "Serialized and re-read library had change in synthetic flag.";
|
|
}
|