Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: pkg/front_end/lib/kernel_generator.dart

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/kernel_generator.dart
diff --git a/pkg/front_end/lib/kernel_generator.dart b/pkg/front_end/lib/kernel_generator.dart
index 0ae2fb3c232c3972cb42593340d31d6670f90884..716191b946d85357034aeefa6116e0a585dce324 100644
--- a/pkg/front_end/lib/kernel_generator.dart
+++ b/pkg/front_end/lib/kernel_generator.dart
@@ -92,8 +92,8 @@ Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
/// obtained from?
Future<Program> kernelForBuildUnit(
List<Uri> sources, CompilerOptions options) async {
- var repository = new Repository();
- var loader = await _createLoader(options, repository: repository);
+ var program = new Program();
+ var loader = await _createLoader(options, program: program);
var context = loader.context;
// Process every library in the build unit.
@@ -112,10 +112,10 @@ Future<Program> kernelForBuildUnit(
// TODO(sigmund): we should look for dependencies using import, export, and
// part directives intead of relying on the dartk-loader. In particular, if a
// library is imported but not used, the logic below will not detect it.
- for (int i = 0; i < repository.libraries.length; ++i) {
- // Note: we don't use a for-in loop because repository.libraries grows as
+ for (int i = 0; i < program.libraries.length; ++i) {
+ // Note: we don't use a for-in loop because program.libraries grows as
// the loader processes libraries.
- var lib = repository.libraries[i];
+ var lib = program.libraries[i];
var source = context.sourceFactory.forUri2(lib.importUri);
if (source is InSummarySource) continue;
if (options.chaseDependencies) {
@@ -128,7 +128,6 @@ Future<Program> kernelForBuildUnit(
}
}
- Program program = new Program(repository.libraries);
_reportErrors(loader.errors, options.onError);
return program;
}
@@ -138,19 +137,19 @@ Future<Program> kernelForBuildUnit(
/// If [options] contain no configuration to resolve `.packages`, the [entry]
/// file will be used to search for a `.packages` file.
Future<DartLoader> _createLoader(CompilerOptions options,
- {Repository repository, Uri entry}) async {
+ {Program program, Uri entry}) async {
var kernelOptions = _convertOptions(options);
var packages = await createPackages(
_uriToPath(options.packagesFileUri, options),
discoveryPath: entry?.path);
- var loader = new DartLoader(
- repository ?? new Repository(), kernelOptions, packages);
+ var loader =
+ new DartLoader(program ?? new Program(), kernelOptions, packages);
var patchPaths = <String, List<String>>{};
// TODO(sigmund,paulberry): use ProcessedOptions so that we can resolve the
// URIs correctly even if sdkRoot is inferred and not specified explicitly.
String resolve(Uri patch) =>
- options.fileSystem.context.fromUri(options.sdkRoot.resolveUri(patch));
+ options.fileSystem.context.fromUri(options.sdkRoot.resolveUri(patch));
options.targetPatches.forEach((uri, patches) {
patchPaths['$uri'] = patches.map(resolve).toList();

Powered by Google App Engine
This is Rietveld 408576698