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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 1617083002: Base JavaScript code position computation on JavaScript tracer. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 11 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 | « pkg/compiler/lib/src/js/js_source_mapping.dart ('k') | pkg/compiler/lib/src/js_backend/js_backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 5a467f5515caa27cf5ef87bf27bd1ff76d74db69..c5d2014ec5c7fb68960c575142c4612656785779 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -502,7 +502,7 @@ class JavaScriptBackend extends Backend {
bool enabledNoSuchMethod = false;
- final SourceInformationStrategy sourceInformationStrategy;
+ SourceInformationStrategy sourceInformationStrategy;
final BackendHelpers helpers;
final BackendImpacts impacts;
@@ -520,7 +520,7 @@ class JavaScriptBackend extends Backend {
this.sourceInformationStrategy =
generateSourceMap
? (useNewSourceInfo
- ? const PositionSourceInformationStrategy()
+ ? new PositionSourceInformationStrategy()
: const StartEndSourceInformationStrategy())
: const JavaScriptSourceInformationStrategy(),
helpers = new BackendHelpers(compiler),
@@ -1630,7 +1630,12 @@ class JavaScriptBackend extends Backend {
}
}
- generatedCode[element] = functionCompiler.compile(work);
+ jsAst.Fun function = functionCompiler.compile(work);
+ if (function.sourceInformation == null) {
+ function = function.withSourceInformation(
+ sourceInformationStrategy.buildSourceMappedMarker());
+ }
+ generatedCode[element] = function;
WorldImpact worldImpact =
impactTransformer.transformCodegenImpact(work.registry.worldImpact);
compiler.dumpInfoTask.registerImpact(element, worldImpact);
@@ -1661,7 +1666,7 @@ class JavaScriptBackend extends Backend {
*/
String getGeneratedCode(Element element) {
assert(invariant(element, element.isDeclaration));
- return jsAst.prettyPrint(generatedCode[element], compiler).getText();
+ return jsAst.prettyPrint(generatedCode[element], compiler);
}
int assembleProgram() {
@@ -2509,13 +2514,13 @@ class JavaScriptBackend extends Backend {
compiler.enabledInvokeOn = true;
}
}
-
+/*
CodeBuffer codeOf(Element element) {
return generatedCode.containsKey(element)
? jsAst.prettyPrint(generatedCode[element], compiler)
: null;
}
-
+*/
FunctionElement helperForBadMain() => helpers.badMain;
FunctionElement helperForMissingMain() => helpers.missingMain;
« no previous file with comments | « pkg/compiler/lib/src/js/js_source_mapping.dart ('k') | pkg/compiler/lib/src/js_backend/js_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698