Index: pkg/compiler/lib/src/js_backend/kernel_task.dart |
diff --git a/pkg/compiler/lib/src/js_backend/kernel_task.dart b/pkg/compiler/lib/src/js_backend/kernel_task.dart |
index ea32143d7f65474f6594d50ac66a7e5266c34020..46e48223faa99bb038eef144a39b52b542e6841a 100644 |
--- a/pkg/compiler/lib/src/js_backend/kernel_task.dart |
+++ b/pkg/compiler/lib/src/js_backend/kernel_task.dart |
@@ -3,6 +3,8 @@ |
// BSD-style license that can be found in the LICENSE file. |
import '../compiler.dart'; |
+import '../common/names.dart'; |
+import '../elements/elements.dart'; |
import '../kernel/kernel.dart'; |
import 'package:kernel/ast.dart' as ir; |
@@ -25,8 +27,16 @@ class KernelTask { |
/// |
/// May enqueue more elements to the resolution queue. |
void buildKernelIr() { |
- program = |
- new ir.Program(kernel.libraryDependencies(_compiler.options.entryPoint)) |
- ..mainMethod = kernel.functionToIr(_compiler.mainFunction); |
+ program = buildProgram(_compiler.mainApp); |
+ } |
+ |
+ /// Builds the kernel IR program for the main function exported from |
+ /// [library]. |
+ /// |
+ /// May enqueue more elements to the resolution queue. |
+ ir.Program buildProgram(LibraryElement library) { |
+ return new ir.Program(kernel.libraryDependencies(library.canonicalUri)) |
+ ..mainMethod = kernel.functionToIr( |
+ library.findExported(Identifiers.main)); |
} |
} |