| OLD | NEW |
| 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 import 'dart:collection' show HashSet, Queue; | 5 import 'dart:collection' show HashSet, Queue; |
| 6 import 'dart:convert' show JSON; | 6 import 'dart:convert' show JSON; |
| 7 import 'dart:io' show File; | 7 import 'dart:io' show File; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart' | 9 import 'package:analyzer/analyzer.dart' |
| 10 show AnalysisError, CompilationUnit, ErrorSeverity; | 10 show AnalysisError, CompilationUnit, ErrorSeverity; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 272 |
| 273 /// Hoist types from class signatures | 273 /// Hoist types from class signatures |
| 274 final bool hoistSignatureTypes; | 274 final bool hoistSignatureTypes; |
| 275 | 275 |
| 276 /// Name types in type tests | 276 /// Name types in type tests |
| 277 final bool nameTypeTests; | 277 final bool nameTypeTests; |
| 278 | 278 |
| 279 /// Hoist types in type tests | 279 /// Hoist types in type tests |
| 280 final bool hoistTypeTests; | 280 final bool hoistTypeTests; |
| 281 | 281 |
| 282 // TODO(kevmoo): Remove once https://github.com/dart-lang/sdk/issues/27255 | |
| 283 // is fixed. | |
| 284 final bool useAngular2Whitelist; | |
| 285 | |
| 286 /// Enable ES6 destructuring of named parameters. Off by default. | 282 /// Enable ES6 destructuring of named parameters. Off by default. |
| 287 /// | 283 /// |
| 288 /// Older V8 versions do not accept default values with destructuring in | 284 /// Older V8 versions do not accept default values with destructuring in |
| 289 /// arrow functions yet (e.g. `({a} = {}) => 1`) but happily accepts them | 285 /// arrow functions yet (e.g. `({a} = {}) => 1`) but happily accepts them |
| 290 /// with regular functions (e.g. `function({a} = {}) { return 1 }`). | 286 /// with regular functions (e.g. `function({a} = {}) { return 1 }`). |
| 291 /// | 287 /// |
| 292 /// Supporting the syntax: | 288 /// Supporting the syntax: |
| 293 /// * Chrome Canary (51) | 289 /// * Chrome Canary (51) |
| 294 /// * Firefox | 290 /// * Firefox |
| 295 /// | 291 /// |
| (...skipping 19 matching lines...) Expand all Loading... |
| 315 this.summaryExtension: 'sum', | 311 this.summaryExtension: 'sum', |
| 316 this.unsafeForceCompile: false, | 312 this.unsafeForceCompile: false, |
| 317 this.replCompile: false, | 313 this.replCompile: false, |
| 318 this.emitMetadata: false, | 314 this.emitMetadata: false, |
| 319 this.closure: false, | 315 this.closure: false, |
| 320 this.destructureNamedParams: false, | 316 this.destructureNamedParams: false, |
| 321 this.hoistInstanceCreation: true, | 317 this.hoistInstanceCreation: true, |
| 322 this.hoistSignatureTypes: false, | 318 this.hoistSignatureTypes: false, |
| 323 this.nameTypeTests: true, | 319 this.nameTypeTests: true, |
| 324 this.hoistTypeTests: true, | 320 this.hoistTypeTests: true, |
| 325 this.useAngular2Whitelist: false, | |
| 326 this.bazelMapping: const {}, | 321 this.bazelMapping: const {}, |
| 327 this.summaryOutPath}); | 322 this.summaryOutPath}); |
| 328 | 323 |
| 329 CompilerOptions.fromArguments(ArgResults args) | 324 CompilerOptions.fromArguments(ArgResults args) |
| 330 : sourceMap = args['source-map'], | 325 : sourceMap = args['source-map'], |
| 331 sourceMapComment = args['source-map-comment'], | 326 sourceMapComment = args['source-map-comment'], |
| 332 inlineSourceMap = args['inline-source-map'], | 327 inlineSourceMap = args['inline-source-map'], |
| 333 summarizeApi = args['summarize'], | 328 summarizeApi = args['summarize'], |
| 334 summaryExtension = args['summary-extension'], | 329 summaryExtension = args['summary-extension'], |
| 335 unsafeForceCompile = args['unsafe-force-compile'], | 330 unsafeForceCompile = args['unsafe-force-compile'], |
| 336 replCompile = args['repl-compile'], | 331 replCompile = args['repl-compile'], |
| 337 emitMetadata = args['emit-metadata'], | 332 emitMetadata = args['emit-metadata'], |
| 338 closure = args['closure-experimental'], | 333 closure = args['closure-experimental'], |
| 339 destructureNamedParams = args['destructure-named-params'], | 334 destructureNamedParams = args['destructure-named-params'], |
| 340 hoistInstanceCreation = args['hoist-instance-creation'], | 335 hoistInstanceCreation = args['hoist-instance-creation'], |
| 341 hoistSignatureTypes = args['hoist-signature-types'], | 336 hoistSignatureTypes = args['hoist-signature-types'], |
| 342 nameTypeTests = args['name-type-tests'], | 337 nameTypeTests = args['name-type-tests'], |
| 343 hoistTypeTests = args['hoist-type-tests'], | 338 hoistTypeTests = args['hoist-type-tests'], |
| 344 useAngular2Whitelist = args['unsafe-angular2-whitelist'], | |
| 345 bazelMapping = _parseBazelMappings(args['bazel-mapping']), | 339 bazelMapping = _parseBazelMappings(args['bazel-mapping']), |
| 346 summaryOutPath = args['summary-out']; | 340 summaryOutPath = args['summary-out']; |
| 347 | 341 |
| 348 static void addArguments(ArgParser parser, {bool hide: true}) { | 342 static void addArguments(ArgParser parser, {bool hide: true}) { |
| 349 parser | 343 parser |
| 350 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) | 344 ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true) |
| 351 ..addOption('summary-extension', | 345 ..addOption('summary-extension', |
| 352 help: 'file extension for Dart summary files', | 346 help: 'file extension for Dart summary files', |
| 353 defaultsTo: 'sum', | 347 defaultsTo: 'sum', |
| 354 hide: hide) | 348 hide: hide) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 383 defaultsTo: true, | 377 defaultsTo: true, |
| 384 hide: hide) | 378 hide: hide) |
| 385 ..addFlag('hoist-signature-types', | 379 ..addFlag('hoist-signature-types', |
| 386 help: 'Hoist types from class signatures', | 380 help: 'Hoist types from class signatures', |
| 387 defaultsTo: false, | 381 defaultsTo: false, |
| 388 hide: hide) | 382 hide: hide) |
| 389 ..addFlag('name-type-tests', | 383 ..addFlag('name-type-tests', |
| 390 help: 'Name types used in type tests', defaultsTo: true, hide: hide) | 384 help: 'Name types used in type tests', defaultsTo: true, hide: hide) |
| 391 ..addFlag('hoist-type-tests', | 385 ..addFlag('hoist-type-tests', |
| 392 help: 'Hoist types used in type tests', defaultsTo: true, hide: hide) | 386 help: 'Hoist types used in type tests', defaultsTo: true, hide: hide) |
| 393 // TODO(kevmoo): Remove once https://github.com/dart-lang/sdk/issues/27255 | |
| 394 // is fixed. | |
| 395 ..addFlag('unsafe-angular2-whitelist', defaultsTo: false, hide: hide) | |
| 396 ..addOption('bazel-mapping', | 387 ..addOption('bazel-mapping', |
| 397 help: | 388 help: |
| 398 '--bazel-mapping=genfiles/to/library.dart,to/library.dart uses \n' | 389 '--bazel-mapping=genfiles/to/library.dart,to/library.dart uses \n' |
| 399 'to/library.dart as the path for library.dart in source maps.', | 390 'to/library.dart as the path for library.dart in source maps.', |
| 400 allowMultiple: true, | 391 allowMultiple: true, |
| 401 splitCommas: false, | 392 splitCommas: false, |
| 402 hide: hide) | 393 hide: hide) |
| 403 ..addOption('summary-out', | 394 ..addOption('summary-out', |
| 404 help: 'location to write the summary file', hide: hide); | 395 help: 'location to write the summary file', hide: hide); |
| 405 } | 396 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 case "dart": | 627 case "dart": |
| 637 case "package": | 628 case "package": |
| 638 case "file": | 629 case "file": |
| 639 // A valid URI. | 630 // A valid URI. |
| 640 return uri; | 631 return uri; |
| 641 default: | 632 default: |
| 642 // Assume a file path. | 633 // Assume a file path. |
| 643 return new Uri.file(path.absolute(source)); | 634 return new Uri.file(path.absolute(source)); |
| 644 } | 635 } |
| 645 } | 636 } |
| OLD | NEW |