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

Side by Side Diff: pkg/front_end/lib/kernel_generator.dart

Issue 2690203002: Add support for additional libraries to FE API (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/compiler_options.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// Defines the front-end API for converting source code to Dart Kernel objects. 5 /// Defines the front-end API for converting source code to Dart Kernel objects.
6 library front_end.kernel_generator; 6 library front_end.kernel_generator;
7 7
8 import 'compilation_error.dart'; 8 import 'compilation_error.dart';
9 import 'compiler_options.dart'; 9 import 'compiler_options.dart';
10 import 'dart:async'; 10 import 'dart:async';
(...skipping 20 matching lines...) Expand all
31 /// code for the SDK. 31 /// code for the SDK.
32 /// 32 ///
33 /// If summaries are provided in [options], they may be used to speed up 33 /// If summaries are provided in [options], they may be used to speed up
34 /// analysis. If in addition `compileSdk` is false, this will speed up 34 /// analysis. If in addition `compileSdk` is false, this will speed up
35 /// compilation, as no source of the sdk will be generated. Note however, that 35 /// compilation, as no source of the sdk will be generated. Note however, that
36 /// summaries for application code can also speed up analysis, but they will not 36 /// summaries for application code can also speed up analysis, but they will not
37 /// take the place of Dart source code (since the Dart source code is still 37 /// take the place of Dart source code (since the Dart source code is still
38 /// needed to access the contents of method bodies). 38 /// needed to access the contents of method bodies).
39 Future<Program> kernelForProgram(Uri source, CompilerOptions options) async { 39 Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
40 var loader = await _createLoader(options, entry: source); 40 var loader = await _createLoader(options, entry: source);
41 // TODO(sigmund): delete this. At this time we have no need to explicitly list 41
42 // VM libraries, since they are normally found by chasing dependencies. 42 if (options.compileSdk) {
43 // `dart:_builtin` is an exception because it is used by the kernel 43 options.additionalLibraries.forEach((e) { print('$e');
Paul Berry 2017/02/13 21:17:42 Is this temporary debugging code? Can we delete i
Siggi Cherem (dart-lang) 2017/02/13 21:23:11 doh! yes, I was debugging on a separate script as
44 // transformers to inform the VM about where the main entrypoint is. This is 44 loader.loadLibrary(e); });
Paul Berry 2017/02/13 21:17:42 Formatting looks weird; run dartfmt.
Siggi Cherem (dart-lang) 2017/02/13 21:23:11 sometimes I make debug code pretty ugly so it is n
45 // expected to change, and we should be able to remove these lines at that
46 // point. We check for the presense of `dart:developer` in the targetPatches
47 // to ensure we only load this library while running on the VM.
48 if (options.compileSdk &&
49 options.targetPatches.containsKey(Uri.parse('dart:developer'))) {
50 loader.loadLibrary(Uri.parse('dart:_builtin'));
51 } 45 }
46
52 // TODO(sigmund): merge what we have in loadEverything and the logic below in 47 // TODO(sigmund): merge what we have in loadEverything and the logic below in
53 // kernelForBuildUnit so there is a single place where we crawl for 48 // kernelForBuildUnit so there is a single place where we crawl for
54 // dependencies. 49 // dependencies.
55 Program program = loader.loadProgram(source, compileSdk: options.compileSdk); 50 Program program = loader.loadProgram(source, compileSdk: options.compileSdk);
56 _reportErrors(loader.errors, options.onError); 51 _reportErrors(loader.errors, options.onError);
57 return program; 52 return program;
58 } 53 }
59 54
60 /// Generates a kernel representation for a build unit. 55 /// Generates a kernel representation for a build unit.
61 /// 56 ///
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 184 }
190 185
191 // TODO(sigmund): delete this class. Dartk should not format errors itself, we 186 // TODO(sigmund): delete this class. Dartk should not format errors itself, we
192 // should just pass them along. 187 // should just pass them along.
193 class _DartkError implements CompilationError { 188 class _DartkError implements CompilationError {
194 String get correction => null; 189 String get correction => null;
195 SourceSpan get span => null; 190 SourceSpan get span => null;
196 final String message; 191 final String message;
197 _DartkError(this.message); 192 _DartkError(this.message);
198 } 193 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/compiler_options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698