| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 leg_apiimpl; | 5 library leg_apiimpl; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:package_config/packages.dart'; | 10 import 'package:package_config/packages.dart'; |
| 11 import 'package:package_config/packages_file.dart' as pkgs; | 11 import 'package:package_config/packages_file.dart' as pkgs; |
| 12 import 'package:package_config/src/packages_impl.dart' show | 12 import 'package:package_config/src/packages_impl.dart' show |
| 13 MapPackages, | 13 MapPackages, |
| 14 NonFilePackagesDirectoryPackages; | 14 NonFilePackagesDirectoryPackages; |
| 15 import 'package:package_config/src/util.dart' show | 15 import 'package:package_config/src/util.dart' show |
| 16 checkValidPackageUri; | 16 checkValidPackageUri; |
| 17 import 'package:sdk_library_metadata/libraries.dart' hide LIBRARIES; | 17 import 'package:sdk_library_metadata/libraries.dart' hide LIBRARIES; |
| 18 import 'package:sdk_library_metadata/libraries.dart' as library_info show | 18 import 'package:sdk_library_metadata/libraries.dart' as library_info show |
| 19 LIBRARIES; | 19 LIBRARIES; |
| 20 | 20 |
| 21 import '../compiler_new.dart' as api; | 21 import '../compiler_new.dart' as api; |
| 22 import 'commandline_options.dart'; | 22 import 'commandline_options.dart'; |
| 23 import 'common/tasks.dart' show | 23 import 'common/tasks.dart' show |
| 24 GenericTask; | 24 GenericTask; |
| 25 import 'compiler.dart' as leg; | 25 import 'compiler.dart' as leg; |
| 26 import 'diagnostics/diagnostic_listener.dart' show | 26 import 'diagnostics/diagnostic_listener.dart' show |
| 27 DiagnosticMessage; | 27 DiagnosticMessage, |
| 28 DiagnosticOptions; |
| 28 import 'diagnostics/messages.dart'; | 29 import 'diagnostics/messages.dart'; |
| 29 import 'diagnostics/source_span.dart' show | 30 import 'diagnostics/source_span.dart' show |
| 30 SourceSpan; | 31 SourceSpan; |
| 31 import 'diagnostics/spannable.dart' show | 32 import 'diagnostics/spannable.dart' show |
| 32 NO_LOCATION_SPANNABLE, | 33 NO_LOCATION_SPANNABLE, |
| 33 Spannable; | 34 Spannable; |
| 34 import 'elements/elements.dart' as elements; | 35 import 'elements/elements.dart' as elements; |
| 35 import 'io/source_file.dart'; | 36 import 'io/source_file.dart'; |
| 36 import 'script.dart'; | 37 import 'script.dart'; |
| 37 | 38 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 analyzeSignaturesOnly: | 91 analyzeSignaturesOnly: |
| 91 hasOption(options, Flags.analyzeSignaturesOnly), | 92 hasOption(options, Flags.analyzeSignaturesOnly), |
| 92 strips: extractCsvOption(options, '--force-strip='), | 93 strips: extractCsvOption(options, '--force-strip='), |
| 93 disableTypeInferenceFlag: | 94 disableTypeInferenceFlag: |
| 94 hasOption(options, Flags.disableTypeInference), | 95 hasOption(options, Flags.disableTypeInference), |
| 95 preserveComments: hasOption(options, Flags.preserveComments), | 96 preserveComments: hasOption(options, Flags.preserveComments), |
| 96 useCpsIr: hasOption(options, Flags.useCpsIr), | 97 useCpsIr: hasOption(options, Flags.useCpsIr), |
| 97 verbose: hasOption(options, Flags.verbose), | 98 verbose: hasOption(options, Flags.verbose), |
| 98 sourceMapUri: extractUriOption(options, '--source-map='), | 99 sourceMapUri: extractUriOption(options, '--source-map='), |
| 99 outputUri: extractUriOption(options, '--out='), | 100 outputUri: extractUriOption(options, '--out='), |
| 100 terseDiagnostics: hasOption(options, Flags.terse), | |
| 101 deferredMapUri: extractUriOption(options, '--deferred-map='), | 101 deferredMapUri: extractUriOption(options, '--deferred-map='), |
| 102 dumpInfo: hasOption(options, Flags.dumpInfo), | 102 dumpInfo: hasOption(options, Flags.dumpInfo), |
| 103 buildId: extractStringOption( | 103 buildId: extractStringOption( |
| 104 options, '--build-id=', | 104 options, '--build-id=', |
| 105 "build number could not be determined"), | 105 "build number could not be determined"), |
| 106 showPackageWarnings: | |
| 107 hasOption(options, Flags.showPackageWarnings), | |
| 108 useContentSecurityPolicy: | 106 useContentSecurityPolicy: |
| 109 hasOption(options, Flags.useContentSecurityPolicy), | 107 hasOption(options, Flags.useContentSecurityPolicy), |
| 110 useStartupEmitter: hasOption(options, Flags.fastStartup), | 108 useStartupEmitter: hasOption(options, Flags.fastStartup), |
| 111 hasIncrementalSupport: | 109 hasIncrementalSupport: |
| 112 forceIncrementalSupport || | 110 forceIncrementalSupport || |
| 113 hasOption(options, Flags.incrementalSupport), | 111 hasOption(options, Flags.incrementalSupport), |
| 114 suppressWarnings: hasOption(options, Flags.suppressWarnings), | 112 diagnosticOptions: new DiagnosticOptions( |
| 115 fatalWarnings: hasOption(options, Flags.fatalWarnings), | 113 suppressWarnings: hasOption(options, Flags.suppressWarnings), |
| 114 fatalWarnings: hasOption(options, Flags.fatalWarnings), |
| 115 suppressHints: hasOption(options, Flags.suppressHints), |
| 116 terseDiagnostics: hasOption(options, Flags.terse), |
| 117 showPackageWarnings: |
| 118 hasOption(options, Flags.showPackageWarnings)), |
| 116 enableExperimentalMirrors: | 119 enableExperimentalMirrors: |
| 117 hasOption(options, Flags.enableExperimentalMirrors), | 120 hasOption(options, Flags.enableExperimentalMirrors), |
| 118 enableAssertMessage: | 121 enableAssertMessage: |
| 119 hasOption(options, Flags.enableAssertMessage), | 122 hasOption(options, Flags.enableAssertMessage), |
| 120 generateCodeWithCompileTimeErrors: | 123 generateCodeWithCompileTimeErrors: |
| 121 hasOption(options, Flags.generateCodeWithCompileTimeErrors), | 124 hasOption(options, Flags.generateCodeWithCompileTimeErrors), |
| 122 testMode: hasOption(options, Flags.testMode), | 125 testMode: hasOption(options, Flags.testMode), |
| 123 allowNativeExtensions: | 126 allowNativeExtensions: |
| 124 hasOption(options, Flags.allowNativeExtensions)) { | 127 hasOption(options, Flags.allowNativeExtensions)) { |
| 125 tasks.addAll([ | 128 tasks.addAll([ |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 log('Total compile-time ${total}msec;' | 473 log('Total compile-time ${total}msec;' |
| 471 ' unaccounted ${total - cumulated}msec'); | 474 ' unaccounted ${total - cumulated}msec'); |
| 472 return success; | 475 return success; |
| 473 }); | 476 }); |
| 474 }); | 477 }); |
| 475 } | 478 } |
| 476 | 479 |
| 477 void reportDiagnostic(DiagnosticMessage message, | 480 void reportDiagnostic(DiagnosticMessage message, |
| 478 List<DiagnosticMessage> infos, | 481 List<DiagnosticMessage> infos, |
| 479 api.Diagnostic kind) { | 482 api.Diagnostic kind) { |
| 483 // TODO(johnniwinther): Move this to the [DiagnosticReporter]? |
| 480 if (kind == api.Diagnostic.ERROR || | 484 if (kind == api.Diagnostic.ERROR || |
| 481 kind == api.Diagnostic.CRASH || | 485 kind == api.Diagnostic.CRASH || |
| 482 (fatalWarnings && kind == api.Diagnostic.WARNING)) { | 486 (reporter.options.fatalWarnings && |
| 487 kind == api.Diagnostic.WARNING)) { |
| 483 compilationFailed = true; | 488 compilationFailed = true; |
| 484 } | 489 } |
| 485 _reportDiagnosticMessage(message, kind); | 490 _reportDiagnosticMessage(message, kind); |
| 486 for (DiagnosticMessage info in infos) { | 491 for (DiagnosticMessage info in infos) { |
| 487 _reportDiagnosticMessage(info, api.Diagnostic.INFO); | 492 _reportDiagnosticMessage(info, api.Diagnostic.INFO); |
| 488 } | 493 } |
| 489 } | 494 } |
| 490 | 495 |
| 491 void _reportDiagnosticMessage(DiagnosticMessage diagnosticMessage, | 496 void _reportDiagnosticMessage(DiagnosticMessage diagnosticMessage, |
| 492 api.Diagnostic kind) { | 497 api.Diagnostic kind) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 544 } |
| 540 } | 545 } |
| 541 | 546 |
| 542 | 547 |
| 543 fromEnvironment(String name) => environment[name]; | 548 fromEnvironment(String name) => environment[name]; |
| 544 | 549 |
| 545 LibraryInfo lookupLibraryInfo(String libraryName) { | 550 LibraryInfo lookupLibraryInfo(String libraryName) { |
| 546 return library_info.LIBRARIES[libraryName]; | 551 return library_info.LIBRARIES[libraryName]; |
| 547 } | 552 } |
| 548 } | 553 } |
| OLD | NEW |