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

Unified Diff: pkg/kernel/lib/transformations/reify/reify_transformer.dart

Issue 2904203003: Don't recreate CoreTypes in transformers. Pass it in. (Closed)
Patch Set: Don't create CoreTypes in createOutlines() on InputError. Created 3 years, 7 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/reify/reify_transformer.dart
diff --git a/pkg/kernel/lib/transformations/reify/reify_transformer.dart b/pkg/kernel/lib/transformations/reify/reify_transformer.dart
index 8a40128831dcdfd9df560b9aa609db77743b86d2..c015cb6e92cff5d2375ab0fb225a78cda3f740a0 100644
--- a/pkg/kernel/lib/transformations/reify/reify_transformer.dart
+++ b/pkg/kernel/lib/transformations/reify/reify_transformer.dart
@@ -41,15 +41,15 @@ RuntimeLibrary findRuntimeTypeLibrary(Program p) {
}
Program transformProgramUsingLibraries(
- Program program, RuntimeLibrary runtimeLibrary,
+ CoreTypes coreTypes, Program program, RuntimeLibrary runtimeLibrary,
[Library libraryToTransform]) {
LibraryFilter filter = libraryToTransform != null
? (Library library) => library == libraryToTransform
: (_) => true;
ProgramKnowledge knowledge = analyze(program, analyzeLibrary: filter);
Library mainLibrary = program.mainMethod.parent;
- RuntimeTypeSupportBuilder builder = new RuntimeTypeSupportBuilder(
- runtimeLibrary, new CoreTypes(program), mainLibrary);
+ RuntimeTypeSupportBuilder builder =
+ new RuntimeTypeSupportBuilder(runtimeLibrary, coreTypes, mainLibrary);
ReifyVisitor transformer =
new ReifyVisitor(runtimeLibrary, builder, knowledge, libraryToTransform);
// Transform the main program.
@@ -66,10 +66,11 @@ Program transformProgramUsingLibraries(
return program;
}
-Program transformProgram(Program program) {
+Program transformProgram(CoreTypes coreTypes, Program program) {
RuntimeLibrary runtimeLibrary = findRuntimeTypeLibrary(program);
Library mainLibrary = program.mainMethod.enclosingLibrary;
- return transformProgramUsingLibraries(program, runtimeLibrary, mainLibrary);
+ return transformProgramUsingLibraries(
+ coreTypes, program, runtimeLibrary, mainLibrary);
}
main(List<String> arguments) async {
@@ -80,11 +81,12 @@ main(List<String> arguments) async {
}
Uri uri = Uri.base.resolve(path);
Program program = loadProgramFromBinary(uri.toFilePath());
+ CoreTypes coreTypes = new CoreTypes(program);
RuntimeLibrary runtimeLibrary = findRuntimeTypeLibrary(program);
Library mainLibrary = program.mainMethod.enclosingLibrary;
- program =
- transformProgramUsingLibraries(program, runtimeLibrary, mainLibrary);
+ program = transformProgramUsingLibraries(
+ coreTypes, program, runtimeLibrary, mainLibrary);
if (output == null) {
// Print result
« no previous file with comments | « pkg/kernel/lib/transformations/mixin_full_resolution.dart ('k') | pkg/kernel/lib/transformations/treeshaker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698