| 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:uri'; | 7 import 'dart:uri'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import '../compiler.dart' as api; | 10 import '../compiler.dart' as api; |
| 11 import 'dart2jslib.dart' as leg; | 11 import 'dart2jslib.dart' as leg; |
| 12 import 'tree/tree.dart' as tree; | 12 import 'tree/tree.dart' as tree; |
| 13 import 'elements/elements.dart' as elements; | 13 import 'elements/elements.dart' as elements; |
| 14 import 'ssa/tracer.dart' as ssa; | 14 import 'ssa/tracer.dart' as ssa; |
| 15 import '../../libraries.dart'; | 15 import '../../libraries.dart'; |
| 16 import 'source_file.dart'; | 16 import 'source_file.dart'; |
| 17 | 17 |
| 18 class Compiler extends leg.Compiler { | 18 class Compiler extends leg.Compiler { |
| 19 api.ReadStringFromUri provider; | 19 api.ReadStringFromUri provider; |
| 20 api.DiagnosticHandler handler; | 20 api.DiagnosticHandler handler; |
| 21 final Uri libraryRoot; | 21 final Uri libraryRoot; |
| 22 final Uri packageRoot; | 22 final Uri packageRoot; |
| 23 List<String> options; | 23 List<String> options; |
| 24 bool mockableLibraryUsed = false; | 24 bool mockableLibraryUsed = false; |
| 25 final Set<String> allowedLibraryCategories; | 25 final Set<String> allowedLibraryCategories; |
| 26 | 26 |
| 27 Compiler(this.provider, this.handler, this.libraryRoot, this.packageRoot, | 27 Compiler(this.provider, |
| 28 api.CompilerOutputProvider outputProvider, |
| 29 this.handler, |
| 30 this.libraryRoot, |
| 31 this.packageRoot, |
| 28 List<String> options) | 32 List<String> options) |
| 29 : this.options = options, | 33 : this.options = options, |
| 30 this.allowedLibraryCategories = getAllowedLibraryCategories(options), | 34 this.allowedLibraryCategories = getAllowedLibraryCategories(options), |
| 31 super( | 35 super( |
| 32 tracer: new ssa.HTracer(), | 36 tracer: new ssa.HTracer(), |
| 37 outputProvider: outputProvider, |
| 33 enableTypeAssertions: hasOption(options, '--enable-checked-mode'), | 38 enableTypeAssertions: hasOption(options, '--enable-checked-mode'), |
| 34 enableUserAssertions: hasOption(options, '--enable-checked-mode'), | 39 enableUserAssertions: hasOption(options, '--enable-checked-mode'), |
| 35 enableMinification: hasOption(options, '--minify'), | 40 enableMinification: hasOption(options, '--minify'), |
| 36 enableNativeLiveTypeAnalysis: | 41 enableNativeLiveTypeAnalysis: |
| 37 !hasOption(options, '--disable-native-live-type-analysis'), | 42 !hasOption(options, '--disable-native-live-type-analysis'), |
| 38 emitJavaScript: !hasOption(options, '--output-type=dart'), | 43 emitJavaScript: !hasOption(options, '--output-type=dart'), |
| 39 disallowUnsafeEval: hasOption(options, '--disallow-unsafe-eval'), | 44 disallowUnsafeEval: hasOption(options, '--disallow-unsafe-eval'), |
| 40 analyzeAll: hasOption(options, '--analyze-all'), | 45 analyzeAll: hasOption(options, '--analyze-all'), |
| 41 analyzeOnly: hasOption(options, '--analyze-only'), | 46 analyzeOnly: hasOption(options, '--analyze-only'), |
| 42 rejectDeprecatedFeatures: | 47 rejectDeprecatedFeatures: |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 handler(translateUri(span.uri, null), span.begin, span.end, | 257 handler(translateUri(span.uri, null), span.begin, span.end, |
| 253 message, kind); | 258 message, kind); |
| 254 } | 259 } |
| 255 } | 260 } |
| 256 | 261 |
| 257 bool get isMockCompilation { | 262 bool get isMockCompilation { |
| 258 return mockableLibraryUsed | 263 return mockableLibraryUsed |
| 259 && (options.indexOf('--allow-mock-compilation') != -1); | 264 && (options.indexOf('--allow-mock-compilation') != -1); |
| 260 } | 265 } |
| 261 } | 266 } |
| OLD | NEW |