| Index: pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
|
| diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
|
| index b101d2b51a3479263bf6655b2dfb1badaa2db154..532e940628cbc20bbc1a2f588d4f36111a5fc01d 100644
|
| --- a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
|
| +++ b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
|
| @@ -1540,15 +1540,20 @@ class Emitter implements js_emitter.Emitter {
|
| }
|
|
|
| if (generateSourceMap) {
|
| - mainOutput.add(generateSourceMapTag(
|
| + mainOutput.add(SourceMapBuilder.generateSourceMapTag(
|
| compiler.options.sourceMapUri, compiler.options.outputUri));
|
| }
|
|
|
| mainOutput.close();
|
|
|
| if (generateSourceMap) {
|
| - outputSourceMap(mainOutput, lineColumnCollector, '',
|
| - compiler.options.sourceMapUri, compiler.options.outputUri);
|
| + SourceMapBuilder.outputSourceMap(
|
| + mainOutput,
|
| + lineColumnCollector,
|
| + '',
|
| + compiler.options.sourceMapUri,
|
| + compiler.options.outputUri,
|
| + compiler.outputProvider);
|
| }
|
| }
|
|
|
| @@ -1639,17 +1644,6 @@ class Emitter implements js_emitter.Emitter {
|
| return outputBuffers.values.fold(0, (a, b) => a + b.length);
|
| }
|
|
|
| - String generateSourceMapTag(Uri sourceMapUri, Uri fileUri) {
|
| - if (sourceMapUri != null && fileUri != null) {
|
| - String sourceMapFileName = relativize(fileUri, sourceMapUri, false);
|
| - return '''
|
| -
|
| -//# sourceMappingURL=$sourceMapFileName
|
| -''';
|
| - }
|
| - return '';
|
| - }
|
| -
|
| ClassBuilder getElementDescriptor(Element element, Fragment fragment) {
|
| Element owner = element.library;
|
| if (!element.isLibrary &&
|
| @@ -1898,9 +1892,10 @@ class Emitter implements js_emitter.Emitter {
|
| 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();
|
| }
|
| @@ -1917,21 +1912,6 @@ class Emitter implements js_emitter.Emitter {
|
| return new jsAst.Comment(generatedBy(compiler, flavor: options.join(", ")));
|
| }
|
|
|
| - void outputSourceMap(
|
| - CodeOutput output, LineColumnProvider lineColumnProvider, String name,
|
| - [Uri sourceMapUri, Uri fileUri]) {
|
| - if (!generateSourceMap) 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();
|
| - }
|
| -
|
| void outputDeferredMap() {
|
| Map<String, dynamic> mapping = new Map<String, dynamic>();
|
| // Json does not support comments, so we embed the explanation in the
|
|
|