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

Unified Diff: pkg/kernel/lib/transformations/closure/mock.dart

Issue 2938773003: Add transformLibraries for closure conversion (Closed)
Patch Set: Merge-in lastest changes in master (f71e6fd49b) Created 3 years, 6 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: pkg/kernel/lib/transformations/closure/mock.dart
diff --git a/pkg/kernel/lib/transformations/closure/mock.dart b/pkg/kernel/lib/transformations/closure/mock.dart
index bf036512a487bfb1548380dde4cf1c8851e72f48..3ca1ce52ebd3a14ea70c117c5f74d9ddb30c891e 100644
--- a/pkg/kernel/lib/transformations/closure/mock.dart
+++ b/pkg/kernel/lib/transformations/closure/mock.dart
@@ -68,7 +68,7 @@ import '../../frontend/accessors.dart'
/// }
///
/// Returns the mock.
-Class mockUpContext(CoreTypes coreTypes, Program program) {
+Library mockUpContextLibrary(CoreTypes coreTypes) {
String fileUri = "dart:mock";
/// final List list;
@@ -202,8 +202,23 @@ Class mockUpContext(CoreTypes coreTypes, Program program) {
Library mock =
new Library(Uri.parse(fileUri), name: "mock", classes: [contextClass])
..fileUri = fileUri;
+
+ return mock;
+}
+
+Class mockUpContextForLibraries(CoreTypes coreTypes, List<Library> libraries) {
+ Library mock = mockUpContextLibrary(coreTypes);
+ Program parent = libraries.length > 0 ? libraries[0]?.parent : null;
+ libraries.add(mock);
+ mock.parent = parent;
+ parent?.uriToSource[mock.fileUri] = new Source(<int>[0], const <int>[]);
+ return mock.classes[0];
+}
+
+Class mockUpContextForProgram(CoreTypes coreTypes, Program program) {
+ Library mock = mockUpContextLibrary(coreTypes);
program.libraries.add(mock);
mock.parent = program;
program.uriToSource[mock.fileUri] = new Source(<int>[0], const <int>[]);
- return contextClass;
+ return mock.classes[0];
}
« no previous file with comments | « pkg/kernel/lib/transformations/closure/info.dart ('k') | pkg/kernel/lib/transformations/closure_conversion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698