| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 sourcemap.helper; | 5 library sourcemap.helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'package:compiler/compiler_new.dart'; | 9 import 'package:compiler/compiler_new.dart'; |
| 10 import 'package:compiler/src/apiimpl.dart' as api; | 10 import 'package:compiler/src/apiimpl.dart' as api; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 List<String> options, | 308 List<String> options, |
| 309 {bool verbose: true, | 309 {bool verbose: true, |
| 310 bool perElement: true, | 310 bool perElement: true, |
| 311 bool forMain: false}) async { | 311 bool forMain: false}) async { |
| 312 OutputProvider outputProvider = outputToFile | 312 OutputProvider outputProvider = outputToFile |
| 313 ? new CloningOutputProvider(targetUri, sourceMapFileUri) | 313 ? new CloningOutputProvider(targetUri, sourceMapFileUri) |
| 314 : new OutputProvider(); | 314 : new OutputProvider(); |
| 315 if (options.contains(Flags.useNewSourceInfo)) { | 315 if (options.contains(Flags.useNewSourceInfo)) { |
| 316 if (verbose) print('Using the new source information system.'); | 316 if (verbose) print('Using the new source information system.'); |
| 317 } | 317 } |
| 318 bool disableInlining = false; |
| 319 if (options.contains(DISABLE_INLINING)) { |
| 320 if (verbose) print('Inlining disabled'); |
| 321 disableInlining = true; |
| 322 } |
| 318 api.CompilerImpl compiler = await compilerFor( | 323 api.CompilerImpl compiler = await compilerFor( |
| 319 outputProvider: outputProvider, | 324 outputProvider: outputProvider, |
| 325 disableInlining: disableInlining, |
| 320 // TODO(johnniwinther): Use [verbose] to avoid showing diagnostics. | 326 // TODO(johnniwinther): Use [verbose] to avoid showing diagnostics. |
| 321 options: ['--out=$targetUri', '--source-map=$sourceMapFileUri'] | 327 options: ['--out=$targetUri', '--source-map=$sourceMapFileUri'] |
| 322 ..addAll(options)); | 328 ..addAll(options)); |
| 323 if (options.contains(DISABLE_INLINING)) { | |
| 324 if (verbose) print('Inlining disabled'); | |
| 325 compiler.disableInlining = true; | |
| 326 } | |
| 327 | 329 |
| 328 JavaScriptBackend backend = compiler.backend; | 330 JavaScriptBackend backend = compiler.backend; |
| 329 var handler = compiler.handler; | 331 var handler = compiler.handler; |
| 330 SourceFileProvider sourceFileProvider = handler.provider; | 332 SourceFileProvider sourceFileProvider = handler.provider; |
| 331 sourceFileManager = new ProviderSourceFileManager( | 333 sourceFileManager = new ProviderSourceFileManager( |
| 332 sourceFileProvider, | 334 sourceFileProvider, |
| 333 outputProvider); | 335 outputProvider); |
| 334 RecordingSourceInformationStrategy strategy = | 336 RecordingSourceInformationStrategy strategy = |
| 335 new RecordingSourceInformationStrategy(backend.sourceInformationStrategy
); | 337 new RecordingSourceInformationStrategy(backend.sourceInformationStrategy
); |
| 336 backend.sourceInformationStrategy = strategy; | 338 backend.sourceInformationStrategy = strategy; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 absoluteUri = base.resolveUri(uri); | 594 absoluteUri = base.resolveUri(uri); |
| 593 } else { | 595 } else { |
| 594 absoluteUri = base.resolve(uri); | 596 absoluteUri = base.resolve(uri); |
| 595 } | 597 } |
| 596 return sourceFiles.putIfAbsent(absoluteUri, () { | 598 return sourceFiles.putIfAbsent(absoluteUri, () { |
| 597 String text = new File.fromUri(absoluteUri).readAsStringSync(); | 599 String text = new File.fromUri(absoluteUri).readAsStringSync(); |
| 598 return new StringSourceFile.fromUri(absoluteUri, text); | 600 return new StringSourceFile.fromUri(absoluteUri, text); |
| 599 }); | 601 }); |
| 600 } | 602 } |
| 601 } | 603 } |
| OLD | NEW |