| Index: pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
|
| diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
|
| index 0e8f7994f1167db00c4f77a58b143ed29f17df41..10b64d5a938c6923754281a29bd2a0c0bdfca9fd 100644
|
| --- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
|
| +++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
|
| @@ -266,15 +266,20 @@ class ModelEmitter {
|
| js.createCodeBuffer(program, compiler, monitor: compiler.dumpInfoTask));
|
|
|
| if (shouldGenerateSourceMap) {
|
| - mainOutput.add(generateSourceMapTag(
|
| + mainOutput.add(SourceMapBuilder.generateSourceMapTag(
|
| compiler.options.sourceMapUri, compiler.options.outputUri));
|
| }
|
|
|
| mainOutput.close();
|
|
|
| if (shouldGenerateSourceMap) {
|
| - outputSourceMap(mainOutput, lineColumnCollector, '',
|
| - compiler.options.sourceMapUri, compiler.options.outputUri);
|
| + SourceMapBuilder.outputSourceMap(
|
| + mainOutput,
|
| + lineColumnCollector,
|
| + '',
|
| + compiler.options.sourceMapUri,
|
| + compiler.options.outputUri,
|
| + compiler.outputProvider);
|
| }
|
| }
|
|
|
| @@ -351,9 +356,10 @@ class ModelEmitter {
|
| compiler.options.outputUri.replace(pathSegments: partSegments);
|
| }
|
|
|
| - output.add(generateSourceMapTag(mapUri, partUri));
|
| + output.add(SourceMapBuilder.generateSourceMapTag(mapUri, partUri));
|
| output.close();
|
| - outputSourceMap(output, lineColumnCollector, partName, mapUri, partUri);
|
| + SourceMapBuilder.outputSourceMap(output, lineColumnCollector, partName,
|
| + mapUri, partUri, compiler.outputProvider);
|
| } else {
|
| output.close();
|
| }
|
| @@ -361,32 +367,6 @@ class ModelEmitter {
|
| return hash;
|
| }
|
|
|
| - String generateSourceMapTag(Uri sourceMapUri, Uri fileUri) {
|
| - if (sourceMapUri != null && fileUri != null) {
|
| - String sourceMapFileName = relativize(fileUri, sourceMapUri, false);
|
| - return '''
|
| -
|
| -//# sourceMappingURL=$sourceMapFileName
|
| -''';
|
| - }
|
| - return '';
|
| - }
|
| -
|
| - void outputSourceMap(
|
| - CodeOutput output, LineColumnProvider lineColumnProvider, String name,
|
| - [Uri sourceMapUri, Uri fileUri]) {
|
| - if (!shouldGenerateSourceMap) return;
|
| - // Create a source file for the compilation output. This allows using
|
| - // [:getLine:] to transform offsets to line numbers in [SourceMapBuilder].
|
| - SourceMapBuilder sourceMapBuilder =
|
| - new SourceMapBuilder(sourceMapUri, fileUri, lineColumnProvider);
|
| - output.forEachSourceLocation(sourceMapBuilder.addMapping);
|
| - String sourceMap = sourceMapBuilder.build();
|
| - compiler.outputProvider(name, 'js.map', OutputType.js_map)
|
| - ..add(sourceMap)
|
| - ..close();
|
| - }
|
| -
|
| /// Writes a mapping from library-name to hunk files.
|
| ///
|
| /// The output is written into a separate file that can be used by outside
|
|
|