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

Unified Diff: lib/compiler/implementation/source_map_builder.dart

Issue 10911091: Add empty mapping entries for the ranges of generated JavaScript that don't map to any Dart source … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 3 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
Index: lib/compiler/implementation/source_map_builder.dart
diff --git a/lib/compiler/implementation/source_map_builder.dart b/lib/compiler/implementation/source_map_builder.dart
index 39798573d5c6cb6368e0df120fb57671534715fd..729991458dea9fa5a1801f68e9881dae1444196e 100644
--- a/lib/compiler/implementation/source_map_builder.dart
+++ b/lib/compiler/implementation/source_map_builder.dart
@@ -70,16 +70,19 @@ class SourceMapBuilder {
}
void writeEntry(_Entry entry, SourceFile targetFile, StringBuffer output) {
- SourceFile sourceFile = entry.sourceFile;
- if (sourceFile === null || entry.sourceOffset >= sourceFile.text.length) {
- return;
- }
-
int targetLine = targetFile.getLine(entry.targetOffset);
int targetColumn = targetFile.getColumn(targetLine, entry.targetOffset);
- String sourceUrl = sourceFile.filename;
- int sourceLine = sourceFile.getLine(entry.sourceOffset);
- int sourceColumn = sourceFile.getColumn(sourceLine, entry.sourceOffset);
+ String sourceUrl;
+ int sourceLine;
+ int sourceColumn;
+ SourceFile sourceFile = entry.sourceFile;
+ // TODO(podivilov): make sure entries are always associated with the right
+ // source file.
+ if (sourceFile != null && entry.sourceOffset < sourceFile.text.length) {
+ sourceUrl = sourceFile.filename;
+ sourceLine = sourceFile.getLine(entry.sourceOffset);
+ sourceColumn = sourceFile.getColumn(sourceLine, entry.sourceOffset);
+ }
String sourceName = entry.sourceName;
if (targetLine > previousTargetLine) {
« no previous file with comments | « lib/compiler/implementation/js_backend/emitter.dart ('k') | tests/compiler/dart2js/source_mapping_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698