| 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 'ssa/tracer.dart' as ssa; | 13 import 'ssa/tracer.dart' as ssa; |
| 14 import '../../libraries.dart'; | 14 import '../../libraries.dart'; |
| 15 import 'source_file.dart'; | 15 import 'source_file.dart'; |
| 16 | 16 |
| 17 class Compiler extends leg.Compiler { | 17 class Compiler extends leg.Compiler { |
| 18 api.CompilerInputProvider provider; | 18 api.CompilerInputProvider provider; |
| 19 api.DiagnosticHandler handler; | 19 api.DiagnosticHandler handler; |
| 20 final Uri libraryRoot; | 20 final Uri libraryRoot; |
| 21 final Uri packageRoot; | 21 final Uri packageRoot; |
| 22 List<String> options; | 22 List<String> options; |
| 23 Map<String, dynamic> environment; |
| 23 bool mockableLibraryUsed = false; | 24 bool mockableLibraryUsed = false; |
| 24 final Set<String> allowedLibraryCategories; | 25 final Set<String> allowedLibraryCategories; |
| 25 | 26 |
| 26 Compiler(this.provider, | 27 Compiler(this.provider, |
| 27 api.CompilerOutputProvider outputProvider, | 28 api.CompilerOutputProvider outputProvider, |
| 28 this.handler, | 29 this.handler, |
| 29 this.libraryRoot, | 30 this.libraryRoot, |
| 30 this.packageRoot, | 31 this.packageRoot, |
| 31 List<String> options) | 32 List<String> options, |
| 33 this.environment) |
| 32 : this.options = options, | 34 : this.options = options, |
| 33 this.allowedLibraryCategories = getAllowedLibraryCategories(options), | 35 this.allowedLibraryCategories = getAllowedLibraryCategories(options), |
| 34 super( | 36 super( |
| 35 tracer: new ssa.HTracer( | 37 tracer: new ssa.HTracer( |
| 36 ssa.GENERATE_SSA_TRACE ? outputProvider('dart', 'cfg') : null), | 38 ssa.GENERATE_SSA_TRACE ? outputProvider('dart', 'cfg') : null), |
| 37 outputProvider: outputProvider, | 39 outputProvider: outputProvider, |
| 38 enableTypeAssertions: hasOption(options, '--enable-checked-mode'), | 40 enableTypeAssertions: hasOption(options, '--enable-checked-mode'), |
| 39 enableUserAssertions: hasOption(options, '--enable-checked-mode'), | 41 enableUserAssertions: hasOption(options, '--enable-checked-mode'), |
| 40 trustTypeAnnotations: | 42 trustTypeAnnotations: |
| 41 hasOption(options, '--trust-type-annotations'), | 43 hasOption(options, '--trust-type-annotations'), |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 diagnoseCrashInUserCode('Uncaught exception in input provider', ex, s); | 324 diagnoseCrashInUserCode('Uncaught exception in input provider', ex, s); |
| 323 rethrow; | 325 rethrow; |
| 324 } | 326 } |
| 325 } | 327 } |
| 326 | 328 |
| 327 void diagnoseCrashInUserCode(String message, exception, stackTrace) { | 329 void diagnoseCrashInUserCode(String message, exception, stackTrace) { |
| 328 hasCrashed = true; | 330 hasCrashed = true; |
| 329 print('$message: ${tryToString(exception)}'); | 331 print('$message: ${tryToString(exception)}'); |
| 330 print(tryToString(stackTrace)); | 332 print(tryToString(stackTrace)); |
| 331 } | 333 } |
| 334 |
| 335 fromEnvironment(String name) => environment[name]; |
| 332 } | 336 } |
| OLD | NEW |