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