| 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 'package:compiler/compiler_new.dart'; |
| 8 import 'package:compiler/src/apiimpl.dart' as api; | 9 import 'package:compiler/src/apiimpl.dart' as api; |
| 9 import 'package:compiler/src/dart2jslib.dart' show NullSink; | 10 import 'package:compiler/src/null_compiler_output.dart' show NullSink; |
| 10 import 'package:compiler/src/elements/elements.dart'; | 11 import 'package:compiler/src/elements/elements.dart'; |
| 11 import 'package:compiler/src/helpers/helpers.dart'; | 12 import 'package:compiler/src/helpers/helpers.dart'; |
| 12 import 'package:compiler/src/filenames.dart'; | 13 import 'package:compiler/src/filenames.dart'; |
| 13 import 'package:compiler/src/io/source_file.dart'; | 14 import 'package:compiler/src/io/source_file.dart'; |
| 14 import 'package:compiler/src/io/source_information.dart'; | 15 import 'package:compiler/src/io/source_information.dart'; |
| 15 import 'package:compiler/src/js/js.dart' as js; | 16 import 'package:compiler/src/js/js.dart' as js; |
| 16 import 'package:compiler/src/js/js_debug.dart'; | 17 import 'package:compiler/src/js/js_debug.dart'; |
| 17 import 'package:compiler/src/js/js_source_mapping.dart'; | 18 import 'package:compiler/src/js/js_source_mapping.dart'; |
| 18 import 'package:compiler/src/js_backend/js_backend.dart'; | 19 import 'package:compiler/src/js_backend/js_backend.dart'; |
| 19 import 'package:compiler/src/source_file_provider.dart'; | 20 import 'package:compiler/src/source_file_provider.dart'; |
| 20 import '../memory_compiler.dart'; | 21 import '../memory_compiler.dart'; |
| 21 import '../output_collector.dart'; | 22 import '../output_collector.dart'; |
| 22 | 23 |
| 23 class OutputProvider { | 24 class OutputProvider implements CompilerOutput { |
| 24 BufferedEventSink jsMapOutput; | 25 BufferedEventSink jsMapOutput; |
| 25 | 26 |
| 26 EventSink<String> call(String name, String extension) { | 27 @override |
| 28 EventSink<String> createEventSink(String name, String extension) { |
| 27 if (extension == 'js.map') { | 29 if (extension == 'js.map') { |
| 28 return jsMapOutput = new BufferedEventSink(); | 30 return jsMapOutput = new BufferedEventSink(); |
| 29 } | 31 } |
| 30 return new NullSink('$name.$extension'); | 32 return new NullSink('$name.$extension'); |
| 31 } | 33 } |
| 32 } | 34 } |
| 33 | 35 |
| 34 class CloningOutputProvider extends OutputProvider { | 36 class CloningOutputProvider extends OutputProvider { |
| 35 RandomAccessFileOutputProvider outputProvider; | 37 RandomAccessFileOutputProvider outputProvider; |
| 36 | 38 |
| 37 CloningOutputProvider(Uri jsUri, Uri jsMapUri) | 39 CloningOutputProvider(Uri jsUri, Uri jsMapUri) |
| 38 : outputProvider = new RandomAccessFileOutputProvider(jsUri, jsMapUri); | 40 : outputProvider = new RandomAccessFileOutputProvider(jsUri, jsMapUri); |
| 39 | 41 |
| 40 EventSink<String> call(String name, String extension) { | 42 @override |
| 43 EventSink<String> createEventSink(String name, String extension) { |
| 41 EventSink<String> output = outputProvider(name, extension); | 44 EventSink<String> output = outputProvider(name, extension); |
| 42 if (extension == 'js.map') { | 45 if (extension == 'js.map') { |
| 43 output = new CloningEventSink( | 46 output = new CloningEventSink( |
| 44 [output, jsMapOutput = new BufferedEventSink()]); | 47 [output, jsMapOutput = new BufferedEventSink()]); |
| 45 } | 48 } |
| 46 return output; | 49 return output; |
| 47 } | 50 } |
| 48 } | 51 } |
| 49 | 52 |
| 50 abstract class SourceFileManager { | 53 abstract class SourceFileManager { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 this.jsCode, | 329 this.jsCode, |
| 327 this.sourceLocation, | 330 this.sourceLocation, |
| 328 this.dartCode, | 331 this.dartCode, |
| 329 {this.isMissing: false}); | 332 {this.isMissing: false}); |
| 330 | 333 |
| 331 String toString() { | 334 String toString() { |
| 332 return 'CodePoint[kind=$kind,js=$jsCode,dart=$dartCode,' | 335 return 'CodePoint[kind=$kind,js=$jsCode,dart=$dartCode,' |
| 333 'location=$sourceLocation]'; | 336 'location=$sourceLocation]'; |
| 334 } | 337 } |
| 335 } | 338 } |
| OLD | NEW |