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

Unified Diff: tests/compiler/dart2js/source_mapping_test.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
« no previous file with comments | « lib/compiler/implementation/source_map_builder.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/source_mapping_test.dart
diff --git a/tests/compiler/dart2js/source_mapping_test.dart b/tests/compiler/dart2js/source_mapping_test.dart
index d6d88afbc9801ff86fb7c45510672608295dec15..e51d55a9746aedaa2dd0d716c7b851729bc961aa 100644
--- a/tests/compiler/dart2js/source_mapping_test.dart
+++ b/tests/compiler/dart2js/source_mapping_test.dart
@@ -9,12 +9,12 @@
#import("mock_compiler.dart");
#import('parser_helper.dart');
-List compileAll(SourceFile sourceFile) {
+CodeBuffer compileAll(SourceFile sourceFile) {
MockCompiler compiler = new MockCompiler();
Uri uri = new Uri.fromComponents(sourceFile.filename);
compiler.sourceFiles[uri.toString()] = sourceFile;
compiler.runCompiler(uri);
- return compiler.backend.emitter.sourceMapBuilder.entries;
+ return compiler.backend.emitter.mainBuffer;
}
void testSourceMapLocations(String codeWithMarkers) {
@@ -27,13 +27,15 @@ void testSourceMapLocations(String codeWithMarkers) {
String code = codeWithMarkers.replaceAll('@', '');
SourceFile sourceFile = new SourceFile('<test script>', code);
- List entries = compileAll(sourceFile);
+ CodeBuffer buffer = compileAll(sourceFile);
+
Set<int> locations = new Set<int>();
- for (var entry in entries) {
- if (entry.sourceFile == sourceFile) {
- locations.add(entry.sourceOffset);
+ buffer.forEachSourceLocation((var element, var token, int offset) {
+ if (element != null &&
+ element.getCompilationUnit().script.file == sourceFile) {
+ locations.add(token.charOffset);
}
- }
+ });
for (int i = 0; i < expectedLocations.length; ++i) {
int expectedLocation = expectedLocations[i];
« no previous file with comments | « lib/compiler/implementation/source_map_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698