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

Unified Diff: pkg/compiler/lib/src/options.dart

Issue 2989453002: Add support for compiling Dart via the FE in dart2js. (Closed)
Patch Set: Created 3 years, 5 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/compiler/lib/src/options.dart
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index 169fce92231597d20be679354286499a20f3abe3..5b0088d33ffc97ce8c73cfa01c278c5f4cbc0eb3 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -202,9 +202,17 @@ class CompilerOptions implements DiagnosticOptions {
/// Whether to use kernel internally as part of compilation.
final bool useKernel;
- /// Read input from a .dill file rather than a .dart input (only to be used in
- /// conjunction with useKernel = true).
- final bool loadFromDill;
+ /// Preview the unified front-end and compilation from kernel.
+ ///
+ /// When enabled the compiler will use the unified front-end to compile
+ /// sources to kernel, and then continue compilation from the kernel
+ /// representation. Setting this flag will implicitly set [useKernel] to true
+ /// as well.
+ ///
+ /// When this flag is on, the compiler also acccepts reading .dill files from
+ /// disk. The compiler reads the sources differently depending on the
+ /// extension format.
+ final bool previewDart2;
// Whether to use kernel internally for global type inference calculations.
// TODO(efortuna): Remove this and consolidate with useKernel.
@@ -324,7 +332,7 @@ class CompilerOptions implements DiagnosticOptions {
useContentSecurityPolicy:
_hasOption(options, Flags.useContentSecurityPolicy),
useKernel: _hasOption(options, Flags.useKernel),
- loadFromDill: _hasOption(options, Flags.loadFromDill),
+ previewDart2: _hasOption(options, Flags.previewDart2),
useFrequencyNamer:
!_hasOption(options, Flags.noFrequencyBasedMinification),
useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo),
@@ -387,7 +395,7 @@ class CompilerOptions implements DiagnosticOptions {
bool trustTypeAnnotations: false,
bool useContentSecurityPolicy: false,
bool useKernel: false,
- bool loadFromDill: false,
+ bool previewDart2: false,
bool useFrequencyNamer: true,
bool useMultiSourceInfo: false,
bool useNewSourceInfo: false,
@@ -432,8 +440,10 @@ class CompilerOptions implements DiagnosticOptions {
suppressWarnings: suppressWarnings,
suppressHints: suppressHints,
shownPackageWarnings: shownPackageWarnings,
- disableInlining: disableInlining,
- disableTypeInference: disableTypeInference,
+ // TODO(sigmund): remove once we support inlining and type-inference
+ // with `previewDart2`.
+ disableInlining: disableInlining || previewDart2,
+ disableTypeInference: disableTypeInference || previewDart2,
dumpInfo: dumpInfo,
enableAssertMessage: enableAssertMessage,
enableExperimentalMirrors: enableExperimentalMirrors,
@@ -443,7 +453,8 @@ class CompilerOptions implements DiagnosticOptions {
enableUserAssertions: enableUserAssertions,
experimentalTrackAllocations: experimentalTrackAllocations,
experimentalAllocationsPath: experimentalAllocationsPath,
- generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors,
+ generateCodeWithCompileTimeErrors:
+ generateCodeWithCompileTimeErrors && !previewDart2,
generateSourceMap: generateSourceMap,
kernelGlobalInference: kernelGlobalInference,
outputUri: outputUri,
@@ -461,8 +472,8 @@ class CompilerOptions implements DiagnosticOptions {
trustPrimitives: trustPrimitives,
trustTypeAnnotations: trustTypeAnnotations,
useContentSecurityPolicy: useContentSecurityPolicy,
- useKernel: useKernel,
- loadFromDill: loadFromDill,
+ useKernel: useKernel || previewDart2,
Emily Fortuna 2017/07/21 21:50:51 can we delete this option, too?
Siggi Cherem (dart-lang) 2017/07/22 00:04:04 Great question - we chatted a bit about this offli
+ previewDart2: previewDart2,
useFrequencyNamer: useFrequencyNamer,
useMultiSourceInfo: useMultiSourceInfo,
useNewSourceInfo: useNewSourceInfo,
@@ -515,7 +526,7 @@ class CompilerOptions implements DiagnosticOptions {
this.trustTypeAnnotations: false,
this.useContentSecurityPolicy: false,
this.useKernel: false,
- this.loadFromDill: false,
+ this.previewDart2: false,
this.useFrequencyNamer: false,
this.useMultiSourceInfo: false,
this.useNewSourceInfo: false,
@@ -575,7 +586,7 @@ class CompilerOptions implements DiagnosticOptions {
trustTypeAnnotations,
useContentSecurityPolicy,
useKernel,
- loadFromDill,
+ previewDart2,
useFrequencyNamer,
useMultiSourceInfo,
useNewSourceInfo,
@@ -647,7 +658,7 @@ class CompilerOptions implements DiagnosticOptions {
useContentSecurityPolicy:
useContentSecurityPolicy ?? options.useContentSecurityPolicy,
useKernel: useKernel ?? options.useKernel,
- loadFromDill: loadFromDill ?? options.loadFromDill,
+ previewDart2: previewDart2 ?? options.previewDart2,
useFrequencyNamer: useFrequencyNamer ?? options.useFrequencyNamer,
useMultiSourceInfo: useMultiSourceInfo ?? options.useMultiSourceInfo,
useNewSourceInfo: useNewSourceInfo ?? options.useNewSourceInfo,

Powered by Google App Engine
This is Rietveld 408576698