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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('source_map_builder'); 5 #library('source_map_builder');
6 6
7 #import('dart:json'); 7 #import('dart:json');
8 8
9 #import('source_file.dart'); 9 #import('source_file.dart');
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 buffer.add(' "sources": '); 63 buffer.add(' "sources": ');
64 JSON.printOn(sourceUrlList, buffer); 64 JSON.printOn(sourceUrlList, buffer);
65 buffer.add(',\n'); 65 buffer.add(',\n');
66 buffer.add(' "names": '); 66 buffer.add(' "names": ');
67 JSON.printOn(sourceNameList, buffer); 67 JSON.printOn(sourceNameList, buffer);
68 buffer.add('\n}\n'); 68 buffer.add('\n}\n');
69 return buffer.toString(); 69 return buffer.toString();
70 } 70 }
71 71
72 void writeEntry(_Entry entry, SourceFile targetFile, StringBuffer output) { 72 void writeEntry(_Entry entry, SourceFile targetFile, StringBuffer output) {
73 SourceFile sourceFile = entry.sourceFile;
74 if (sourceFile === null || entry.sourceOffset >= sourceFile.text.length) {
75 return;
76 }
77
78 int targetLine = targetFile.getLine(entry.targetOffset); 73 int targetLine = targetFile.getLine(entry.targetOffset);
79 int targetColumn = targetFile.getColumn(targetLine, entry.targetOffset); 74 int targetColumn = targetFile.getColumn(targetLine, entry.targetOffset);
80 String sourceUrl = sourceFile.filename; 75 String sourceUrl;
81 int sourceLine = sourceFile.getLine(entry.sourceOffset); 76 int sourceLine;
82 int sourceColumn = sourceFile.getColumn(sourceLine, entry.sourceOffset); 77 int sourceColumn;
78 SourceFile sourceFile = entry.sourceFile;
79 // TODO(podivilov): make sure enties are always associated with the right
floitsch 2012/09/05 14:22:18 entries
podivilov 2012/09/06 10:52:25 Done.
80 // source file.
81 if (sourceFile != null && entry.sourceOffset < sourceFile.text.length) {
82 sourceUrl = sourceFile.filename;
83 sourceLine = sourceFile.getLine(entry.sourceOffset);
84 sourceColumn = sourceFile.getColumn(sourceLine, entry.sourceOffset);
85 }
83 String sourceName = entry.sourceName; 86 String sourceName = entry.sourceName;
84 87
85 if (targetLine > previousTargetLine) { 88 if (targetLine > previousTargetLine) {
86 for (int i = previousTargetLine; i < targetLine; ++i) { 89 for (int i = previousTargetLine; i < targetLine; ++i) {
87 output.add(';'); 90 output.add(';');
88 } 91 }
89 previousTargetLine = targetLine; 92 previousTargetLine = targetLine;
90 previousTargetColumn = 0; 93 previousTargetColumn = 0;
91 firstEntryInLine = true; 94 firstEntryInLine = true;
92 } 95 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 152 }
150 153
151 class _Entry { 154 class _Entry {
152 SourceFile sourceFile; 155 SourceFile sourceFile;
153 int sourceOffset; 156 int sourceOffset;
154 String sourceName; 157 String sourceName;
155 int targetOffset; 158 int targetOffset;
156 _Entry(this.sourceFile, this.sourceOffset, this.sourceName, 159 _Entry(this.sourceFile, this.sourceOffset, this.sourceName,
157 this.targetOffset); 160 this.targetOffset);
158 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698