Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/old_emitter/emitter.dart

Issue 656783002: Revert "Add support for source maps in deferred libraries." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/source_map_deferred_d2js_validity_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | tests/compiler/dart2js/source_map_deferred_d2js_validity_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698