This repository was archived by the owner on Feb 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change
1
+ ## 1.6.6
2
+
3
+ * ` new Trace.current() ` and ` new Chain.current() ` now skip an extra frame when
4
+ run in a JS context. This makes their return values match the VM context.
5
+
1
6
## 1.6.5
2
7
3
8
* Really fix strong mode warnings.
Original file line number Diff line number Diff line change @@ -81,7 +81,11 @@ class Trace implements StackTrace {
81
81
}
82
82
83
83
var trace = new Trace .from (StackTrace .current);
84
- return new LazyTrace (() => new Trace (trace.frames.skip (level + 1 )));
84
+ return new LazyTrace (() {
85
+ // JS includes a frame for the call to StackTrace.current, but the VM
86
+ // doesn't, so we skip an extra frame in a JS context.
87
+ return new Trace (trace.frames.skip (level + (inJS ? 2 : 1 )));
88
+ });
85
89
}
86
90
87
91
/// Returns a new stack trace containing the same data as [trace] .
Original file line number Diff line number Diff line change 2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
+ import 'package:path/path.dart' as p;
6
+
5
7
/// The line used in the string representation of stack chains to represent
6
8
/// the gap between traces.
7
9
const chainGap = '===== asynchronous gap ===========================\n ' ;
8
10
11
+ // TODO(nweiz): When cross-platform imports work, use them to set this.
12
+ /// Whether we're running in a JS context.
13
+ final bool inJS = p.style == p.Style .url;
14
+
9
15
/// Returns [string] with enough spaces added to the end to make it [length]
10
16
/// characters long.
11
17
String padRight (String string, int length) {
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ name: stack_trace
7
7
#
8
8
# When the major version is upgraded, you *must* update that version constraint
9
9
# in pub to stay in sync with this.
10
- version : 1.6.6-dev
10
+ version : 1.6.6
11
11
author :
" Dart Team <[email protected] >"
12
12
homepage : https://github.com/dart-lang/stack_trace
13
13
description : >
You can’t perform that action at this time.
0 commit comments