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 var entryLibrary = program.libraries.last; |
scheglov
2017/06/07 21:31:16
I thought about doing this, but decided that this
Siggi Cherem (dart-lang)
2017/06/07 21:36:10
Good point, what do you think of either of these t
scheglov
2017/06/07 21:38:42
Yeah, we know for sure that it is in the last resu
| |
141 program.mainMethod = library.procedures.firstWhere( | 141 assert(entryLibrary.importUri == _entryPoint); |
142 (procedure) => procedure.name.name == 'main', | 142 program.mainMethod = entryLibrary.procedures.firstWhere( |
143 orElse: () => null); | 143 (procedure) => procedure.name.name == 'main', |
144 break; | 144 orElse: () => null); |
145 } | |
146 } | 145 } |
147 | 146 |
148 return new DeltaProgram(program); | 147 return new DeltaProgram(program); |
149 }); | 148 }); |
150 } | 149 } |
151 | 150 |
152 @override | 151 @override |
153 void invalidate(Uri uri) { | 152 void invalidate(Uri uri) { |
154 _invalidatedFiles.add(uri); | 153 _invalidatedFiles.add(uri); |
155 } | 154 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 /// TODO(scheglov) Use API signatures. | 324 /// TODO(scheglov) Use API signatures. |
326 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. | 325 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. |
327 final String signature; | 326 final String signature; |
328 | 327 |
329 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies | 328 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies |
330 /// are not included, but but references to those dependencies are included. | 329 /// are not included, but but references to those dependencies are included. |
331 final List<Library> kernelLibraries; | 330 final List<Library> kernelLibraries; |
332 | 331 |
333 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); | 332 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); |
334 } | 333 } |
OLD | NEW |