Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /// Defines the front-end API for converting source code to Dart Kernel objects. | |
| 6 library front_end.kernel_generator; | |
| 7 | |
| 8 import 'dart:async'; | |
| 9 import 'options.dart'; | |
| 10 import 'package:kernel/kernel.dart' as kernel; | |
| 11 | |
| 12 /// Processes the program whose main library is in the given [source]. | |
|
Siggi Cherem (dart-lang)
2016/10/17 16:27:29
Processes => Generate Kernel for ...
Paul Berry
2016/10/17 17:04:27
Done.
| |
| 13 /// | |
| 14 /// Intended for whole program (non-modular) compilation. | |
| 15 /// | |
| 16 /// Given the Uri of a file containing a program's `main` method, this function | |
| 17 /// follows `import`, `export`, and `part` declarations to discover the whole | |
| 18 /// program, and converts the result to Dart Kernel format. | |
| 19 /// | |
| 20 /// If summaries are provided in [options], they may be used to speed up | |
| 21 /// analysis, but they will not take the place of Dart source code (since the | |
| 22 /// Dart source code is still needed to access the contents of method bodies). | |
| 23 Future<kernel.Program> compileProgram(Options options, Uri source) => | |
|
Brian Wilkerson
2016/10/17 15:08:14
Using "compile" seems wrong here (and below), beca
Siggi Cherem (dart-lang)
2016/10/17 16:27:29
other ideas:
- generateKernel
- programToKernel
Paul Berry
2016/10/17 17:04:27
I like the "fooFor" convention, but when we need t
| |
| 24 throw new UnimplementedError(); | |
| 25 | |
| 26 /// Processes the build unit whose source files are in [sources]. | |
| 27 /// | |
| 28 /// Intended for modular compilation. | |
| 29 /// | |
| 30 /// [sources] should be the complete set of source files for a build unit | |
| 31 /// (including both library and part files). All of the library files are | |
| 32 /// compiled to Dart Kernel objects. | |
|
Brian Wilkerson
2016/10/17 15:08:14
nit: Does Kernel have a name for its representatio
Paul Berry
2016/10/17 17:04:27
Kernel calls them "Library". Changed to "Dart Ker
| |
| 33 /// | |
| 34 /// The compilation process is hermetic, meaning that the only files which will | |
| 35 /// be read are those listed in [sources], [Options.inputSummaries], and | |
| 36 /// [Options.sdkSummary]. If a source file attempts to refer to a file which is | |
| 37 /// not obtainable from these paths, that will result in an error, even if the | |
| 38 /// file exists on the filesystem. | |
| 39 /// | |
| 40 /// Any `part` declarations found in [sources] must refer to part files which | |
| 41 /// are also listed in [sources], otherwise an error results. (It is not | |
| 42 /// permitted to refer to a part file declared in another build unit). | |
| 43 /// | |
| 44 /// The return value is a [kernel.Program] object with no main method set. | |
| 45 /// | |
| 46 /// TODO(paulberry): does additional information need to be output to allow the | |
| 47 /// caller to match up referenced elements to the summary files they were | |
| 48 /// obtained from? | |
| 49 Future<kernel.Program> compileBuildUnit(Options options, List<Uri> sources) => | |
|
Siggi Cherem (dart-lang)
2016/10/17 16:27:29
if we rename "compileProgram", I'd rename this too
Siggi Cherem (dart-lang)
2016/10/17 16:27:29
nit: change the return type, since a build-unit is
Paul Berry
2016/10/17 17:04:27
Went with "kernelForBuildUnit" here, and "resolved
Paul Berry
2016/10/17 17:04:27
kernel.Program also contains a `uriToLineStarts` m
| |
| 50 throw new UnimplementedError(); | |
| OLD | NEW |