OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:front_end/file_system.dart'; | 8 import 'package:front_end/file_system.dart'; |
9 import 'package:front_end/incremental_kernel_generator.dart'; | 9 import 'package:front_end/incremental_kernel_generator.dart'; |
10 import 'package:front_end/src/base/api_signature.dart'; | 10 import 'package:front_end/src/base/api_signature.dart'; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 if (watch != null) _fsState.fileUris.forEach((f) => watch(f, true)); | 131 if (watch != null) _fsState.fileUris.forEach((f) => watch(f, true)); |
132 | 132 |
133 // TODO(scheglov) Add libraries which import changed libraries. | 133 // TODO(scheglov) Add libraries which import changed libraries. |
134 // For now the corresponding test works because we use full library | 134 // For now the corresponding test works because we use full library |
135 // contents to compute signatures (not just API parts). So, every library | 135 // contents to compute signatures (not just API parts). So, every library |
136 // that imports a changed one, is affected. | 136 // that imports a changed one, is affected. |
137 | 137 |
138 // Set the main method. | 138 // Set the main method. |
139 for (var library in program.libraries) { | 139 if (program.libraries.isNotEmpty) { |
140 if (library.fileUri == _entryPoint.toString()) { | 140 for (Library library in results.last.kernelLibraries) { |
141 program.mainMethod = library.procedures.firstWhere( | 141 if (library.importUri == _entryPoint) { |
142 (procedure) => procedure.name.name == 'main', | 142 program.mainMethod = library.procedures.firstWhere( |
143 orElse: () => null); | 143 (procedure) => procedure.name.name == 'main', |
144 break; | 144 orElse: () => null); |
| 145 break; |
| 146 } |
145 } | 147 } |
146 } | 148 } |
147 | 149 |
148 return new DeltaProgram(program); | 150 return new DeltaProgram(program); |
149 }); | 151 }); |
150 } | 152 } |
151 | 153 |
152 @override | 154 @override |
153 void invalidate(Uri uri) { | 155 void invalidate(Uri uri) { |
154 _invalidatedFiles.add(uri); | 156 _invalidatedFiles.add(uri); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 /// TODO(scheglov) Use API signatures. | 327 /// TODO(scheglov) Use API signatures. |
326 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. | 328 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. |
327 final String signature; | 329 final String signature; |
328 | 330 |
329 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies | 331 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies |
330 /// are not included, but but references to those dependencies are included. | 332 /// are not included, but but references to those dependencies are included. |
331 final List<Library> kernelLibraries; | 333 final List<Library> kernelLibraries; |
332 | 334 |
333 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); | 335 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); |
334 } | 336 } |
OLD | NEW |