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

Side by Side Diff: pkg/compiler/lib/src/options.dart

Issue 1975153002: Support (de)serialization from command-line (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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
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 library dart2js.src.options; 5 library dart2js.src.options;
6 6
7 import 'commandline_options.dart' show Flags; 7 import 'commandline_options.dart' show Flags;
8 import '../compiler.dart' show PackagesDiscoveryProvider; 8 import '../compiler.dart' show PackagesDiscoveryProvider;
9 9
10 /// Options used for parsing. 10 /// Options used for parsing.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 /// URI of the main output if the compiler is generating source maps. 181 /// URI of the main output if the compiler is generating source maps.
182 final Uri outputUri; 182 final Uri outputUri;
183 183
184 /// Location of the platform configuration file. 184 /// Location of the platform configuration file.
185 final Uri platformConfigUri; 185 final Uri platformConfigUri;
186 186
187 /// Whether to emit URIs in the reflection metadata. 187 /// Whether to emit URIs in the reflection metadata.
188 final bool preserveUris; 188 final bool preserveUris;
189 189
190 final Uri serializationSource;
191 final Uri serializationTarget;
192
190 /// URI where the compiler should generate the output source map file. 193 /// URI where the compiler should generate the output source map file.
191 final Uri sourceMapUri; 194 final Uri sourceMapUri;
192 195
193 /// The compiler is run from the build bot. 196 /// The compiler is run from the build bot.
194 final bool testMode; 197 final bool testMode;
195 198
196 /// Whether to trust JS-interop annotations. (experimental) 199 /// Whether to trust JS-interop annotations. (experimental)
197 final bool trustJSInteropTypeAnnotations; 200 final bool trustJSInteropTypeAnnotations;
198 201
199 /// Whether to trust primitive types during inference and optimizations. 202 /// Whether to trust primitive types during inference and optimizations.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 243
241 /// Strip option used by dart2dart. 244 /// Strip option used by dart2dart.
242 final List<String> strips; 245 final List<String> strips;
243 246
244 /// Create an options object by parsing flags from [options]. 247 /// Create an options object by parsing flags from [options].
245 factory CompilerOptions.parse( 248 factory CompilerOptions.parse(
246 {Uri entryPoint, 249 {Uri entryPoint,
247 Uri libraryRoot, 250 Uri libraryRoot,
248 Uri packageRoot, 251 Uri packageRoot,
249 Uri packageConfig, 252 Uri packageConfig,
253 Uri serializationSource,
254 Uri serializationTarget,
250 PackagesDiscoveryProvider packagesDiscoveryProvider, 255 PackagesDiscoveryProvider packagesDiscoveryProvider,
251 Map<String, dynamic> environment: const <String, dynamic>{}, 256 Map<String, dynamic> environment: const <String, dynamic>{},
252 List<String> options}) { 257 List<String> options}) {
253 return new CompilerOptions( 258 return new CompilerOptions(
254 entryPoint: entryPoint, 259 entryPoint: entryPoint,
255 libraryRoot: libraryRoot, 260 libraryRoot: libraryRoot,
256 packageRoot: packageRoot, 261 packageRoot: packageRoot,
257 packageConfig: packageConfig, 262 packageConfig: packageConfig,
258 packagesDiscoveryProvider: packagesDiscoveryProvider, 263 packagesDiscoveryProvider: packagesDiscoveryProvider,
259 environment: environment, 264 environment: environment,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 generateCodeWithCompileTimeErrors: 296 generateCodeWithCompileTimeErrors:
292 _hasOption(options, Flags.generateCodeWithCompileTimeErrors), 297 _hasOption(options, Flags.generateCodeWithCompileTimeErrors),
293 generateSourceMap: !_hasOption(options, Flags.noSourceMaps), 298 generateSourceMap: !_hasOption(options, Flags.noSourceMaps),
294 hasIncrementalSupport: _forceIncrementalSupport || 299 hasIncrementalSupport: _forceIncrementalSupport ||
295 _hasOption(options, Flags.incrementalSupport), 300 _hasOption(options, Flags.incrementalSupport),
296 outputUri: _extractUriOption(options, '--out='), 301 outputUri: _extractUriOption(options, '--out='),
297 platformConfigUri: 302 platformConfigUri:
298 _resolvePlatformConfigFromOptions(libraryRoot, options), 303 _resolvePlatformConfigFromOptions(libraryRoot, options),
299 preserveComments: _hasOption(options, Flags.preserveComments), 304 preserveComments: _hasOption(options, Flags.preserveComments),
300 preserveUris: _hasOption(options, Flags.preserveUris), 305 preserveUris: _hasOption(options, Flags.preserveUris),
306 serializationSource: serializationSource,
307 serializationTarget: serializationTarget,
301 sourceMapUri: _extractUriOption(options, '--source-map='), 308 sourceMapUri: _extractUriOption(options, '--source-map='),
302 strips: _extractCsvOption(options, '--force-strip='), 309 strips: _extractCsvOption(options, '--force-strip='),
303 testMode: _hasOption(options, Flags.testMode), 310 testMode: _hasOption(options, Flags.testMode),
304 trustJSInteropTypeAnnotations: 311 trustJSInteropTypeAnnotations:
305 _hasOption(options, Flags.trustJSInteropTypeAnnotations), 312 _hasOption(options, Flags.trustJSInteropTypeAnnotations),
306 trustPrimitives: _hasOption(options, Flags.trustPrimitives), 313 trustPrimitives: _hasOption(options, Flags.trustPrimitives),
307 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations), 314 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations),
308 useContentSecurityPolicy: 315 useContentSecurityPolicy:
309 _hasOption(options, Flags.useContentSecurityPolicy), 316 _hasOption(options, Flags.useContentSecurityPolicy),
310 useCpsIr: _hasOption(options, Flags.useCpsIr), 317 useCpsIr: _hasOption(options, Flags.useCpsIr),
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 bool enableNativeLiveTypeAnalysis: true, 359 bool enableNativeLiveTypeAnalysis: true,
353 bool enableTypeAssertions: false, 360 bool enableTypeAssertions: false,
354 bool enableUserAssertions: false, 361 bool enableUserAssertions: false,
355 bool generateCodeWithCompileTimeErrors: false, 362 bool generateCodeWithCompileTimeErrors: false,
356 bool generateSourceMap: true, 363 bool generateSourceMap: true,
357 bool hasIncrementalSupport: false, 364 bool hasIncrementalSupport: false,
358 Uri outputUri: null, 365 Uri outputUri: null,
359 Uri platformConfigUri: null, 366 Uri platformConfigUri: null,
360 bool preserveComments: false, 367 bool preserveComments: false,
361 bool preserveUris: false, 368 bool preserveUris: false,
369 Uri serializationSource: null,
370 Uri serializationTarget: null,
362 Uri sourceMapUri: null, 371 Uri sourceMapUri: null,
363 List<String> strips: const [], 372 List<String> strips: const [],
364 bool testMode: false, 373 bool testMode: false,
365 bool trustJSInteropTypeAnnotations: false, 374 bool trustJSInteropTypeAnnotations: false,
366 bool trustPrimitives: false, 375 bool trustPrimitives: false,
367 bool trustTypeAnnotations: false, 376 bool trustTypeAnnotations: false,
368 bool useContentSecurityPolicy: false, 377 bool useContentSecurityPolicy: false,
369 bool useCpsIr: false, 378 bool useCpsIr: false,
370 bool useFrequencyNamer: true, 379 bool useFrequencyNamer: true,
371 bool useNewSourceInfo: false, 380 bool useNewSourceInfo: false,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 enableUserAssertions: enableUserAssertions, 432 enableUserAssertions: enableUserAssertions,
424 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors, 433 generateCodeWithCompileTimeErrors: generateCodeWithCompileTimeErrors,
425 generateSourceMap: generateSourceMap, 434 generateSourceMap: generateSourceMap,
426 hasIncrementalSupport: hasIncrementalSupport, 435 hasIncrementalSupport: hasIncrementalSupport,
427 outputUri: outputUri, 436 outputUri: outputUri,
428 platformConfigUri: platformConfigUri ?? 437 platformConfigUri: platformConfigUri ??
429 _resolvePlatformConfig( 438 _resolvePlatformConfig(
430 libraryRoot, null, !emitJavaScript, const []), 439 libraryRoot, null, !emitJavaScript, const []),
431 preserveComments: preserveComments, 440 preserveComments: preserveComments,
432 preserveUris: preserveUris, 441 preserveUris: preserveUris,
442 serializationSource: serializationSource,
443 serializationTarget: serializationTarget,
433 sourceMapUri: sourceMapUri, 444 sourceMapUri: sourceMapUri,
434 strips: strips, 445 strips: strips,
435 testMode: testMode, 446 testMode: testMode,
436 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, 447 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations,
437 trustPrimitives: trustPrimitives, 448 trustPrimitives: trustPrimitives,
438 trustTypeAnnotations: trustTypeAnnotations, 449 trustTypeAnnotations: trustTypeAnnotations,
439 useContentSecurityPolicy: useContentSecurityPolicy, 450 useContentSecurityPolicy: useContentSecurityPolicy,
440 useCpsIr: useCpsIr, 451 useCpsIr: useCpsIr,
441 useFrequencyNamer: useFrequencyNamer, 452 useFrequencyNamer: useFrequencyNamer,
442 useNewSourceInfo: useNewSourceInfo, 453 useNewSourceInfo: useNewSourceInfo,
(...skipping 28 matching lines...) Expand all
471 this.enableNativeLiveTypeAnalysis: false, 482 this.enableNativeLiveTypeAnalysis: false,
472 this.enableTypeAssertions: false, 483 this.enableTypeAssertions: false,
473 this.enableUserAssertions: false, 484 this.enableUserAssertions: false,
474 this.generateCodeWithCompileTimeErrors: false, 485 this.generateCodeWithCompileTimeErrors: false,
475 this.generateSourceMap: true, 486 this.generateSourceMap: true,
476 this.hasIncrementalSupport: false, 487 this.hasIncrementalSupport: false,
477 this.outputUri: null, 488 this.outputUri: null,
478 this.platformConfigUri: null, 489 this.platformConfigUri: null,
479 this.preserveComments: false, 490 this.preserveComments: false,
480 this.preserveUris: false, 491 this.preserveUris: false,
492 this.serializationSource: null,
493 this.serializationTarget: null,
481 this.sourceMapUri: null, 494 this.sourceMapUri: null,
482 this.strips: const [], 495 this.strips: const [],
483 this.testMode: false, 496 this.testMode: false,
484 this.trustJSInteropTypeAnnotations: false, 497 this.trustJSInteropTypeAnnotations: false,
485 this.trustPrimitives: false, 498 this.trustPrimitives: false,
486 this.trustTypeAnnotations: false, 499 this.trustTypeAnnotations: false,
487 this.useContentSecurityPolicy: false, 500 this.useContentSecurityPolicy: false,
488 this.useCpsIr: false, 501 this.useCpsIr: false,
489 this.useFrequencyNamer: false, 502 this.useFrequencyNamer: false,
490 this.useNewSourceInfo: false, 503 this.useNewSourceInfo: false,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 603
591 /// Locations of the platform descriptor files relative to the library root. 604 /// Locations of the platform descriptor files relative to the library root.
592 const String _clientPlatform = "lib/dart_client.platform"; 605 const String _clientPlatform = "lib/dart_client.platform";
593 const String _serverPlatform = "lib/dart_server.platform"; 606 const String _serverPlatform = "lib/dart_server.platform";
594 const String _sharedPlatform = "lib/dart_shared.platform"; 607 const String _sharedPlatform = "lib/dart_shared.platform";
595 const String _dart2dartPlatform = "lib/dart2dart.platform"; 608 const String _dart2dartPlatform = "lib/dart2dart.platform";
596 609
597 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; 610 const String _UNDETERMINED_BUILD_ID = "build number could not be determined";
598 const bool _forceIncrementalSupport = 611 const bool _forceIncrementalSupport =
599 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); 612 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698