Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(872)

Unified Diff: tests/compiler/dart2js/serialization_test.dart

Issue 1811173003: Support per-library serialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/serialization_test.dart
diff --git a/tests/compiler/dart2js/serialization_test.dart b/tests/compiler/dart2js/serialization_test.dart
index 4ef28f2451106ee959dc4b9194a6cc7d6c2e3a8c..70bb90629bc206ddf91d791eeae0927231a5e079 100644
--- a/tests/compiler/dart2js/serialization_test.dart
+++ b/tests/compiler/dart2js/serialization_test.dart
@@ -7,6 +7,7 @@ library dart2js.serialization_test;
import 'dart:io';
import 'memory_compiler.dart';
import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/constants/constructors.dart';
import 'package:compiler/src/constants/expressions.dart';
import 'package:compiler/src/dart_types.dart';
@@ -47,7 +48,7 @@ main(List<String> arguments) {
}
asyncTest(() async {
CompilationResult result = await runCompiler(
- entryPoint: entryPoint, options: ['--analyze-all']);
+ entryPoint: entryPoint, options: [Flags.analyzeAll]);
Compiler compiler = result.compiler;
testSerialization(compiler.libraryLoader.libraries,
outPath: outPath,
@@ -58,11 +59,11 @@ main(List<String> arguments) {
void testSerialization(Iterable<LibraryElement> libraries1,
{String outPath,
bool prettyPrint}) {
- Serializer serializer = new Serializer(const JsonSerializationEncoder());
+ Serializer serializer = new Serializer();
for (LibraryElement library1 in libraries1) {
serializer.serialize(library1);
}
- String text = serializer.toText();
+ String text = serializer.toText(const JsonSerializationEncoder());
String outText = text;
if (prettyPrint) {
outText = serializer.prettyPrint();
@@ -74,6 +75,7 @@ void testSerialization(Iterable<LibraryElement> libraries1,
}
Deserializer deserializer = new Deserializer.fromText(
+ new DeserializationContext(),
text, const JsonSerializationDecoder());
List<LibraryElement> libraries2 = <LibraryElement>[];
for (LibraryElement library1 in libraries1) {
@@ -86,13 +88,14 @@ void testSerialization(Iterable<LibraryElement> libraries1,
libraries2.add(library2);
}
- Serializer serializer2 = new Serializer(const JsonSerializationEncoder());
+ Serializer serializer2 = new Serializer();
for (LibraryElement library2 in libraries2) {
serializer2.serialize(library2);
}
- String text2 = serializer2.toText();
+ String text2 = serializer2.toText(const JsonSerializationEncoder());
Deserializer deserializer3 = new Deserializer.fromText(
+ new DeserializationContext(),
text2, const JsonSerializationDecoder());
for (LibraryElement library1 in libraries1) {
LibraryElement library2 =
@@ -133,6 +136,7 @@ checkElementProperties(
/// Uses [object1], [object2] and [property] to provide context for failures.
checkElementLists(Object object1, Object object2, String property,
Iterable<Element> list1, Iterable<Element> list2) {
+ //print('checking\n> $list1\n> $list2');
checkListEquivalence(object1, object2, property,
list1, list2, checkElementProperties);
}
@@ -477,6 +481,7 @@ class ElementPropertyEquivalence extends BaseElementVisitor<dynamic, Element> {
check(element1, element2, 'name', element1.name, element2.name);
check(element1, element2, 'libraryName',
element1.libraryName, element2.libraryName);
+ //print('checkingMembers of library ${element1.name}');
visitMembers(element1, element2);
visit(element1.entryCompilationUnit, element2.entryCompilationUnit);
@@ -645,6 +650,7 @@ class ElementPropertyEquivalence extends BaseElementVisitor<dynamic, Element> {
getConstructors(element1),
getConstructors(element2));
+ //print('Checking class members of ${element1} vs ${element2} (${element2.runtimeType})');
Siggi Cherem (dart-lang) 2016/03/18 20:00:20 delete this and other commented lines above?
Johnni Winther 2016/03/29 09:05:54 Done.
visitMembers(element1, element2);
}

Powered by Google App Engine
This is Rietveld 408576698