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

Unified Diff: lib/source_map_stack_trace.dart

Issue 1113453006: Fix an off-by-one bug between stack_trace and source_maps. (Closed) Base URL: git@github.com:dart-lang/source_map_stack_trace.git@master
Patch Set: Created 5 years, 8 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 | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/source_map_stack_trace.dart
diff --git a/lib/source_map_stack_trace.dart b/lib/source_map_stack_trace.dart
index a5a22b31727c9ede2ff51b1054f05159153f1586..41072e4fa70cbedadd697e055f115dddfc89ffa6 100644
--- a/lib/source_map_stack_trace.dart
+++ b/lib/source_map_stack_trace.dart
@@ -51,7 +51,10 @@ StackTrace mapStackTrace(Mapping sourceMap, StackTrace stackTrace,
// If there's no column, try using the first column of the line.
var column = frame.column == null ? 0 : frame.column;
- var span = sourceMap.spanFor(frame.line, column);
+
+ // Subtract 1 because stack traces use 1-indexed lines and columns and
+ // source maps uses 0-indexed.
+ var span = sourceMap.spanFor(frame.line - 1, column - 1);
// If we can't find a source span, ignore the frame. It's probably something
// internal that the user doesn't care about.
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698