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

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

Issue 2690083002: Add MultiSourceInformationStrategy (Closed)
Patch Set: Cleanup. 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
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 '../compiler.dart' show PackagesDiscoveryProvider; 7 import '../compiler.dart' show PackagesDiscoveryProvider;
8 import 'commandline_options.dart' show Flags; 8 import 'commandline_options.dart' show Flags;
9 9
10 /// Options used for controlling diagnostic messages. 10 /// Options used for controlling diagnostic messages.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 /// Whether to generate code compliant with content security policy (CSP). 199 /// Whether to generate code compliant with content security policy (CSP).
200 final bool useContentSecurityPolicy; 200 final bool useContentSecurityPolicy;
201 201
202 /// Whether to use kernel internally as part of compilation. 202 /// Whether to use kernel internally as part of compilation.
203 final bool useKernel; 203 final bool useKernel;
204 204
205 /// When obfuscating for minification, whether to use the frequency of a name 205 /// When obfuscating for minification, whether to use the frequency of a name
206 /// as an heuristic to pick shorter names. 206 /// as an heuristic to pick shorter names.
207 final bool useFrequencyNamer; 207 final bool useFrequencyNamer;
208 208
209 /// Whether to generate source-information from both the old and the new
210 /// source-information engines. (experimental)
211 final bool useMultiSourceInfo;
212
209 /// Whether to use the new source-information implementation for source-maps. 213 /// Whether to use the new source-information implementation for source-maps.
210 /// (experimental) 214 /// (experimental)
211 final bool useNewSourceInfo; 215 final bool useNewSourceInfo;
212 216
213 /// Whether the user requested to use the fast startup emitter. The full 217 /// Whether the user requested to use the fast startup emitter. The full
214 /// emitter might still be used if the program uses dart:mirrors. 218 /// emitter might still be used if the program uses dart:mirrors.
215 final bool useStartupEmitter; 219 final bool useStartupEmitter;
216 220
217 /// Enable verbose printing during compilation. Includes progress messages 221 /// Enable verbose printing during compilation. Includes progress messages
218 /// during each phase and a time-breakdown between phases at the end. 222 /// during each phase and a time-breakdown between phases at the end.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 testMode: _hasOption(options, Flags.testMode), 292 testMode: _hasOption(options, Flags.testMode),
289 trustJSInteropTypeAnnotations: 293 trustJSInteropTypeAnnotations:
290 _hasOption(options, Flags.trustJSInteropTypeAnnotations), 294 _hasOption(options, Flags.trustJSInteropTypeAnnotations),
291 trustPrimitives: _hasOption(options, Flags.trustPrimitives), 295 trustPrimitives: _hasOption(options, Flags.trustPrimitives),
292 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations), 296 trustTypeAnnotations: _hasOption(options, Flags.trustTypeAnnotations),
293 useContentSecurityPolicy: 297 useContentSecurityPolicy:
294 _hasOption(options, Flags.useContentSecurityPolicy), 298 _hasOption(options, Flags.useContentSecurityPolicy),
295 useKernel: _hasOption(options, Flags.useKernel), 299 useKernel: _hasOption(options, Flags.useKernel),
296 useFrequencyNamer: 300 useFrequencyNamer:
297 !_hasOption(options, Flags.noFrequencyBasedMinification), 301 !_hasOption(options, Flags.noFrequencyBasedMinification),
302 useMultiSourceInfo: _hasOption(options, Flags.useMultiSourceInfo),
298 useNewSourceInfo: _hasOption(options, Flags.useNewSourceInfo), 303 useNewSourceInfo: _hasOption(options, Flags.useNewSourceInfo),
299 useStartupEmitter: _hasOption(options, Flags.fastStartup), 304 useStartupEmitter: _hasOption(options, Flags.fastStartup),
300 verbose: _hasOption(options, Flags.verbose)); 305 verbose: _hasOption(options, Flags.verbose));
301 } 306 }
302 307
303 /// Creates an option object for the compiler. 308 /// Creates an option object for the compiler.
304 /// 309 ///
305 /// This validates and normalizes dependent options to be consistent. For 310 /// This validates and normalizes dependent options to be consistent. For
306 /// example, if [analyzeAll] is true, the resulting options object will also 311 /// example, if [analyzeAll] is true, the resulting options object will also
307 /// have [analyzeOnly] as true. 312 /// have [analyzeOnly] as true.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 bool resolveOnly: false, 350 bool resolveOnly: false,
346 Uri sourceMapUri: null, 351 Uri sourceMapUri: null,
347 List<String> strips: const [], 352 List<String> strips: const [],
348 bool testMode: false, 353 bool testMode: false,
349 bool trustJSInteropTypeAnnotations: false, 354 bool trustJSInteropTypeAnnotations: false,
350 bool trustPrimitives: false, 355 bool trustPrimitives: false,
351 bool trustTypeAnnotations: false, 356 bool trustTypeAnnotations: false,
352 bool useContentSecurityPolicy: false, 357 bool useContentSecurityPolicy: false,
353 bool useKernel: false, 358 bool useKernel: false,
354 bool useFrequencyNamer: true, 359 bool useFrequencyNamer: true,
360 bool useMultiSourceInfo: false,
355 bool useNewSourceInfo: false, 361 bool useNewSourceInfo: false,
356 bool useStartupEmitter: false, 362 bool useStartupEmitter: false,
357 bool verbose: false}) { 363 bool verbose: false}) {
358 // TODO(sigmund): should entrypoint be here? should we validate it is not 364 // TODO(sigmund): should entrypoint be here? should we validate it is not
359 // null? In unittests we use the same compiler to analyze or build multiple 365 // null? In unittests we use the same compiler to analyze or build multiple
360 // entrypoints. 366 // entrypoints.
361 if (libraryRoot == null) { 367 if (libraryRoot == null) {
362 throw new ArgumentError("[libraryRoot] is null."); 368 throw new ArgumentError("[libraryRoot] is null.");
363 } 369 }
364 if (!libraryRoot.path.endsWith("/")) { 370 if (!libraryRoot.path.endsWith("/")) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 resolveOnly: resolveOnly, 421 resolveOnly: resolveOnly,
416 sourceMapUri: sourceMapUri, 422 sourceMapUri: sourceMapUri,
417 strips: strips, 423 strips: strips,
418 testMode: testMode, 424 testMode: testMode,
419 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, 425 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations,
420 trustPrimitives: trustPrimitives, 426 trustPrimitives: trustPrimitives,
421 trustTypeAnnotations: trustTypeAnnotations, 427 trustTypeAnnotations: trustTypeAnnotations,
422 useContentSecurityPolicy: useContentSecurityPolicy, 428 useContentSecurityPolicy: useContentSecurityPolicy,
423 useKernel: useKernel, 429 useKernel: useKernel,
424 useFrequencyNamer: useFrequencyNamer, 430 useFrequencyNamer: useFrequencyNamer,
431 useMultiSourceInfo: useMultiSourceInfo,
425 useNewSourceInfo: useNewSourceInfo, 432 useNewSourceInfo: useNewSourceInfo,
426 useStartupEmitter: useStartupEmitter, 433 useStartupEmitter: useStartupEmitter,
427 verbose: verbose); 434 verbose: verbose);
428 } 435 }
429 436
430 CompilerOptions._(this.entryPoint, this.libraryRoot, this.packageRoot, 437 CompilerOptions._(this.entryPoint, this.libraryRoot, this.packageRoot,
431 this.packageConfig, this.packagesDiscoveryProvider, this.environment, 438 this.packageConfig, this.packagesDiscoveryProvider, this.environment,
432 {this.allowMockCompilation: false, 439 {this.allowMockCompilation: false,
433 this.allowNativeExtensions: false, 440 this.allowNativeExtensions: false,
434 this.analyzeAll: false, 441 this.analyzeAll: false,
(...skipping 28 matching lines...) Expand all
463 this.compileOnly: false, 470 this.compileOnly: false,
464 this.sourceMapUri: null, 471 this.sourceMapUri: null,
465 this.strips: const [], 472 this.strips: const [],
466 this.testMode: false, 473 this.testMode: false,
467 this.trustJSInteropTypeAnnotations: false, 474 this.trustJSInteropTypeAnnotations: false,
468 this.trustPrimitives: false, 475 this.trustPrimitives: false,
469 this.trustTypeAnnotations: false, 476 this.trustTypeAnnotations: false,
470 this.useContentSecurityPolicy: false, 477 this.useContentSecurityPolicy: false,
471 this.useKernel: false, 478 this.useKernel: false,
472 this.useFrequencyNamer: false, 479 this.useFrequencyNamer: false,
480 this.useMultiSourceInfo: false,
473 this.useNewSourceInfo: false, 481 this.useNewSourceInfo: false,
474 this.useStartupEmitter: false, 482 this.useStartupEmitter: false,
475 this.verbose: false}) 483 this.verbose: false})
476 : _shownPackageWarnings = shownPackageWarnings; 484 : _shownPackageWarnings = shownPackageWarnings;
477 485
478 /// Creates a copy of the [CompilerOptions] where the provided non-null 486 /// Creates a copy of the [CompilerOptions] where the provided non-null
479 /// option values replace existing. 487 /// option values replace existing.
480 static CompilerOptions copy(CompilerOptions options, 488 static CompilerOptions copy(CompilerOptions options,
481 {entryPoint, 489 {entryPoint,
482 libraryRoot, 490 libraryRoot,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 compileOnly, 526 compileOnly,
519 sourceMapUri, 527 sourceMapUri,
520 strips, 528 strips,
521 testMode, 529 testMode,
522 trustJSInteropTypeAnnotations, 530 trustJSInteropTypeAnnotations,
523 trustPrimitives, 531 trustPrimitives,
524 trustTypeAnnotations, 532 trustTypeAnnotations,
525 useContentSecurityPolicy, 533 useContentSecurityPolicy,
526 useKernel, 534 useKernel,
527 useFrequencyNamer, 535 useFrequencyNamer,
536 useMultiSourceInfo,
528 useNewSourceInfo, 537 useNewSourceInfo,
529 useStartupEmitter, 538 useStartupEmitter,
530 verbose}) { 539 verbose}) {
531 return new CompilerOptions._( 540 return new CompilerOptions._(
532 entryPoint ?? options.entryPoint, 541 entryPoint ?? options.entryPoint,
533 libraryRoot ?? options.libraryRoot, 542 libraryRoot ?? options.libraryRoot,
534 packageRoot ?? options.packageRoot, 543 packageRoot ?? options.packageRoot,
535 packageConfig ?? options.packageConfig, 544 packageConfig ?? options.packageConfig,
536 packagesDiscoveryProvider ?? options.packagesDiscoveryProvider, 545 packagesDiscoveryProvider ?? options.packagesDiscoveryProvider,
537 environment ?? options.environment, 546 environment ?? options.environment,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 testMode: testMode ?? options.testMode, 591 testMode: testMode ?? options.testMode,
583 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations ?? 592 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations ??
584 options.trustJSInteropTypeAnnotations, 593 options.trustJSInteropTypeAnnotations,
585 trustPrimitives: trustPrimitives ?? options.trustPrimitives, 594 trustPrimitives: trustPrimitives ?? options.trustPrimitives,
586 trustTypeAnnotations: 595 trustTypeAnnotations:
587 trustTypeAnnotations ?? options.trustTypeAnnotations, 596 trustTypeAnnotations ?? options.trustTypeAnnotations,
588 useContentSecurityPolicy: 597 useContentSecurityPolicy:
589 useContentSecurityPolicy ?? options.useContentSecurityPolicy, 598 useContentSecurityPolicy ?? options.useContentSecurityPolicy,
590 useKernel: useKernel ?? options.useKernel, 599 useKernel: useKernel ?? options.useKernel,
591 useFrequencyNamer: useFrequencyNamer ?? options.useFrequencyNamer, 600 useFrequencyNamer: useFrequencyNamer ?? options.useFrequencyNamer,
601 useMultiSourceInfo: useMultiSourceInfo ?? options.useMultiSourceInfo,
592 useNewSourceInfo: useNewSourceInfo ?? options.useNewSourceInfo, 602 useNewSourceInfo: useNewSourceInfo ?? options.useNewSourceInfo,
593 useStartupEmitter: useStartupEmitter ?? options.useStartupEmitter, 603 useStartupEmitter: useStartupEmitter ?? options.useStartupEmitter,
594 verbose: verbose ?? options.verbose); 604 verbose: verbose ?? options.verbose);
595 } 605 }
596 606
597 /// Returns `true` if warnings and hints are shown for all packages. 607 /// Returns `true` if warnings and hints are shown for all packages.
598 bool get showAllPackageWarnings { 608 bool get showAllPackageWarnings {
599 return _shownPackageWarnings != null && _shownPackageWarnings.isEmpty; 609 return _shownPackageWarnings != null && _shownPackageWarnings.isEmpty;
600 } 610 }
601 611
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 _extractStringOption(options, "--platform-config=", null), 696 _extractStringOption(options, "--platform-config=", null),
687 _extractCsvOption(options, '--categories=')); 697 _extractCsvOption(options, '--categories='));
688 } 698 }
689 699
690 /// Locations of the platform descriptor files relative to the library root. 700 /// Locations of the platform descriptor files relative to the library root.
691 const String _clientPlatform = "lib/dart_client.platform"; 701 const String _clientPlatform = "lib/dart_client.platform";
692 const String _serverPlatform = "lib/dart_server.platform"; 702 const String _serverPlatform = "lib/dart_server.platform";
693 const String _sharedPlatform = "lib/dart_shared.platform"; 703 const String _sharedPlatform = "lib/dart_shared.platform";
694 704
695 const String _UNDETERMINED_BUILD_ID = "build number could not be determined"; 705 const String _UNDETERMINED_BUILD_ID = "build number could not be determined";
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart ('k') | tests/compiler/dart2js/exit_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698