| 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 library fasta.kernel_target; | 5 library fasta.kernel_target; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:io' show File, IOSink; | 9 import 'dart:io' show File, IOSink; |
| 10 | 10 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 mainBuilder.body = new ExpressionStatement( | 303 mainBuilder.body = new ExpressionStatement( |
| 304 new Throw(new StringLiteral("${errors.join('\n')}"))); | 304 new Throw(new StringLiteral("${errors.join('\n')}"))); |
| 305 } | 305 } |
| 306 library.build(); | 306 library.build(); |
| 307 return link(<Library>[library.library]); | 307 return link(<Library>[library.library]); |
| 308 } | 308 } |
| 309 | 309 |
| 310 /// Creates a program by combining [libraries] with the libraries of | 310 /// Creates a program by combining [libraries] with the libraries of |
| 311 /// `dillTarget.loader.program`. | 311 /// `dillTarget.loader.program`. |
| 312 Program link(List<Library> libraries) { | 312 Program link(List<Library> libraries) { |
| 313 Map<String, Source> uriToSource = <String, Source>{}; | 313 Map<String, Source> uriToSource = |
| 314 | 314 new Map<String, Source>.from(this.uriToSource); |
| 315 // for (Library library in libraries) { | |
| 316 // // TODO(ahe): Compute line starts instead. | |
| 317 // uriToLineStarts[library.fileUri] = <int>[0]; | |
| 318 // } | |
| 319 | 315 |
| 320 final Program binary = dillTarget.loader.program; | 316 final Program binary = dillTarget.loader.program; |
| 321 if (binary != null) { | 317 if (binary != null) { |
| 322 libraries.addAll(binary.libraries); | 318 libraries.addAll(binary.libraries); |
| 323 uriToSource.addAll(binary.uriToSource); | 319 uriToSource.addAll(binary.uriToSource); |
| 324 } | 320 } |
| 325 | 321 |
| 326 // TODO(ahe): Remove this line. Kernel seems to generate a default line map | 322 // TODO(ahe): Remove this line. Kernel seems to generate a default line map |
| 327 // that used when there's no fileUri on an element. Instead, ensure all | 323 // that used when there's no fileUri on an element. Instead, ensure all |
| 328 // elements have a fileUri. | 324 // elements have a fileUri. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 605 } |
| 610 for (Constructor constructor in superclass.constructors) { | 606 for (Constructor constructor in superclass.constructors) { |
| 611 if (constructor.name.name.isEmpty) { | 607 if (constructor.name.name.isEmpty) { |
| 612 return constructor.function.requiredParameterCount == 0 | 608 return constructor.function.requiredParameterCount == 0 |
| 613 ? constructor | 609 ? constructor |
| 614 : null; | 610 : null; |
| 615 } | 611 } |
| 616 } | 612 } |
| 617 return null; | 613 return null; |
| 618 } | 614 } |
| OLD | NEW |