| 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 | 8 |
| 9 import '../compiler.dart' as api; | 9 import '../compiler.dart' as api; |
| 10 import 'dart2jslib.dart' as leg; | 10 import 'dart2jslib.dart' as leg; |
| 11 import 'tree/tree.dart' as tree; | 11 import 'tree/tree.dart' as tree; |
| 12 import 'elements/elements.dart' as elements; | 12 import 'elements/elements.dart' as elements; |
| 13 import '../../libraries.dart'; | 13 import '../../libraries.dart'; |
| 14 import 'source_file.dart'; | 14 import 'source_file.dart'; |
| 15 | 15 |
| 16 const bool forceIncrementalSupport = |
| 17 const bool.fromEnvironment('DART2JS_EXPERIMENTAL_INCREMENTAL_SUPPORT'); |
| 16 | 18 |
| 17 class Compiler extends leg.Compiler { | 19 class Compiler extends leg.Compiler { |
| 18 api.CompilerInputProvider provider; | 20 api.CompilerInputProvider provider; |
| 19 api.DiagnosticHandler handler; | 21 api.DiagnosticHandler handler; |
| 20 final Uri libraryRoot; | 22 final Uri libraryRoot; |
| 21 final Uri packageRoot; | 23 final Uri packageRoot; |
| 22 List<String> options; | 24 List<String> options; |
| 23 Map<String, dynamic> environment; | 25 Map<String, dynamic> environment; |
| 24 bool mockableLibraryUsed = false; | 26 bool mockableLibraryUsed = false; |
| 25 final Set<String> allowedLibraryCategories; | 27 final Set<String> allowedLibraryCategories; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 sourceMapUri: extractUriOption(options, '--source-map='), | 66 sourceMapUri: extractUriOption(options, '--source-map='), |
| 65 outputUri: extractUriOption(options, '--out='), | 67 outputUri: extractUriOption(options, '--out='), |
| 66 terseDiagnostics: hasOption(options, '--terse'), | 68 terseDiagnostics: hasOption(options, '--terse'), |
| 67 dumpInfo: hasOption(options, '--dump-info'), | 69 dumpInfo: hasOption(options, '--dump-info'), |
| 68 buildId: extractStringOption( | 70 buildId: extractStringOption( |
| 69 options, '--build-id=', | 71 options, '--build-id=', |
| 70 "build number could not be determined"), | 72 "build number could not be determined"), |
| 71 showPackageWarnings: | 73 showPackageWarnings: |
| 72 hasOption(options, '--show-package-warnings'), | 74 hasOption(options, '--show-package-warnings'), |
| 73 useContentSecurityPolicy: hasOption(options, '--csp'), | 75 useContentSecurityPolicy: hasOption(options, '--csp'), |
| 74 hasIncrementalSupport: hasOption(options, '--incremental-support'), | 76 hasIncrementalSupport: |
| 77 forceIncrementalSupport || |
| 78 hasOption(options, '--incremental-support'), |
| 75 suppressWarnings: hasOption(options, '--suppress-warnings')) { | 79 suppressWarnings: hasOption(options, '--suppress-warnings')) { |
| 76 tasks.addAll([ | 80 tasks.addAll([ |
| 77 userHandlerTask = new leg.GenericTask('Diagnostic handler', this), | 81 userHandlerTask = new leg.GenericTask('Diagnostic handler', this), |
| 78 userProviderTask = new leg.GenericTask('Input provider', this), | 82 userProviderTask = new leg.GenericTask('Input provider', this), |
| 79 ]); | 83 ]); |
| 80 if (!libraryRoot.path.endsWith("/")) { | 84 if (!libraryRoot.path.endsWith("/")) { |
| 81 throw new ArgumentError("libraryRoot must end with a /"); | 85 throw new ArgumentError("libraryRoot must end with a /"); |
| 82 } | 86 } |
| 83 if (packageRoot != null && !packageRoot.path.endsWith("/")) { | 87 if (packageRoot != null && !packageRoot.path.endsWith("/")) { |
| 84 throw new ArgumentError("packageRoot must end with a /"); | 88 throw new ArgumentError("packageRoot must end with a /"); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 348 } |
| 345 | 349 |
| 346 void diagnoseCrashInUserCode(String message, exception, stackTrace) { | 350 void diagnoseCrashInUserCode(String message, exception, stackTrace) { |
| 347 hasCrashed = true; | 351 hasCrashed = true; |
| 348 print('$message: ${tryToString(exception)}'); | 352 print('$message: ${tryToString(exception)}'); |
| 349 print(tryToString(stackTrace)); | 353 print(tryToString(stackTrace)); |
| 350 } | 354 } |
| 351 | 355 |
| 352 fromEnvironment(String name) => environment[name]; | 356 fromEnvironment(String name) => environment[name]; |
| 353 } | 357 } |
| OLD | NEW |