| Index: sdk/lib/_internal/compiler/implementation/js_emitter/old_emitter/emitter.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/old_emitter/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/old_emitter/emitter.dart
|
| index cde4a58be3c2f8aa8e4696b22cf991104af56195..5af1cde6c8c8197dd48214b6734f128c8483cb34 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_emitter/old_emitter/emitter.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_emitter/old_emitter/emitter.dart
|
| @@ -1293,7 +1293,7 @@ class OldEmitter implements Emitter {
|
| cspPrecompiledConstructorNamesFor(outputUnit).add(js('#', constructorName));
|
| }
|
|
|
| - /// Extracts the output name of the compiler's outputUri.
|
| + /// Returns a name composed of the main output file name and [name].
|
| String deferredPartFileName(OutputUnit outputUnit,
|
| {bool addExtension: true}) {
|
| String outPath = compiler.outputUri != null
|
| @@ -1646,14 +1646,15 @@ class OldEmitter implements Emitter {
|
| }
|
|
|
| String assembledCode = mainBuffer.getText();
|
| + String sourceMapTags = "";
|
| if (generateSourceMap) {
|
| outputSourceMap(assembledCode, mainBuffer, '',
|
| compiler.sourceMapUri, compiler.outputUri);
|
| - mainBuffer.add(
|
| - generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri));
|
| - assembledCode = mainBuffer.getText();
|
| + sourceMapTags =
|
| + generateSourceMapTag(compiler.sourceMapUri, compiler.outputUri);
|
| }
|
| -
|
| + mainBuffer.add(sourceMapTags);
|
| + assembledCode = mainBuffer.getText();
|
| compiler.outputProvider('', 'js')
|
| ..add(assembledCode)
|
| ..close();
|
| @@ -1883,38 +1884,23 @@ class OldEmitter implements Emitter {
|
| allowVariableMinification: false).getText());
|
| }
|
|
|
| + String code = outputBuffer.getText();
|
| +
|
| // Make a unique hash of the code (before the sourcemaps are added)
|
| // This will be used to retrieve the initializing function from the global
|
| // variable.
|
| - String hash = hashOfString(outputBuffer.getText());
|
| -
|
| - outputBuffer.add('${deferredInitializers}["$hash"]$_=$_'
|
| - '${deferredInitializers}.current$N');
|
| -
|
| - String partPrefix = deferredPartFileName(outputUnit, addExtension: false);
|
| - if (generateSourceMap) {
|
| - String partName = "$partPrefix.part";
|
| - String mapFileName = partName + ".js.map";
|
| - List<String> mapSegments = compiler.sourceMapUri.pathSegments.toList();
|
| - mapSegments[mapSegments.length - 1] = mapFileName;
|
| - Uri mapUri = compiler.sourceMapUri.replace(pathSegments: mapSegments);
|
| -
|
| - String partFileName = partName + ".js";
|
| - List<String> partSegments = compiler.outputUri.pathSegments.toList();
|
| - partSegments[mapSegments.length - 1] = partFileName;
|
| - Uri partUri = compiler.outputUri.replace(pathSegments: partSegments);
|
| -
|
| - outputSourceMap(outputBuffer.getText(), outputBuffer, partName,
|
| - mapUri, partUri);
|
| - outputBuffer.add(generateSourceMapTag(mapUri, partUri));
|
| - }
|
| + String hash = hashOfString(code);
|
|
|
| outputBuffers[outputUnit] = outputBuffer;
|
| - compiler.outputProvider(partPrefix, 'part.js')
|
| - ..add(outputBuffer.getText())
|
| + compiler.outputProvider(
|
| + deferredPartFileName(outputUnit, addExtension: false), 'part.js')
|
| + ..add(code)
|
| + ..add('${deferredInitializers}["$hash"]$_=$_'
|
| + '${deferredInitializers}.current$N')
|
| ..close();
|
|
|
| hunkHashes[outputUnit] = hash;
|
| + // TODO(johnniwinther): Support source maps for deferred code.
|
| }
|
| return hunkHashes;
|
| }
|
|
|