OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import '../common/names.dart'; | 5 import '../common/names.dart'; |
6 import '../common/tasks.dart' show CompilerTask; | 6 import '../common/tasks.dart' show CompilerTask; |
7 import '../compiler.dart'; | 7 import '../compiler.dart'; |
8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
9 import 'kernel.dart'; | 9 import 'kernel.dart'; |
10 import 'package:kernel/ast.dart' as ir; | 10 import 'package:kernel/ast.dart' as ir; |
(...skipping 11 matching lines...) Expand all Loading... |
22 : this._compiler = compiler, | 22 : this._compiler = compiler, |
23 this.kernel = new Kernel(compiler), | 23 this.kernel = new Kernel(compiler), |
24 super(compiler.measurer); | 24 super(compiler.measurer); |
25 | 25 |
26 ir.Program program; | 26 ir.Program program; |
27 | 27 |
28 /// Builds the kernel IR for the main function. | 28 /// Builds the kernel IR for the main function. |
29 /// | 29 /// |
30 /// May enqueue more elements to the resolution queue. | 30 /// May enqueue more elements to the resolution queue. |
31 void buildKernelIr() => measure(() { | 31 void buildKernelIr() => measure(() { |
32 program = buildProgram(_compiler.mainApp); | 32 program = buildProgram( |
| 33 _compiler.frontendStrategy.elementEnvironment.mainLibrary); |
33 }); | 34 }); |
34 | 35 |
35 /// Builds the kernel IR program for the main function exported from | 36 /// Builds the kernel IR program for the main function exported from |
36 /// [library]. | 37 /// [library]. |
37 /// | 38 /// |
38 /// May enqueue more elements to the resolution queue. | 39 /// May enqueue more elements to the resolution queue. |
39 ir.Program buildProgram(LibraryElement library) { | 40 ir.Program buildProgram(LibraryElement library) { |
40 MethodElement main = library.findExported(Identifiers.main); | 41 MethodElement main = library.findExported(Identifiers.main); |
41 if (main == null) { | 42 if (main == null) { |
42 main = _compiler.frontendStrategy.commonElements.missingMain; | 43 main = _compiler.frontendStrategy.commonElements.missingMain; |
43 } | 44 } |
44 return new ir.Program( | 45 return new ir.Program( |
45 libraries: kernel.libraryDependencies(library.canonicalUri)) | 46 libraries: kernel.libraryDependencies(library.canonicalUri)) |
46 ..mainMethod = kernel.functionToIr(main); | 47 ..mainMethod = kernel.functionToIr(main); |
47 } | 48 } |
48 } | 49 } |
OLD | NEW |