Skip to content

Commit dfb94f3

Browse files
authored
Fix analysis hints. (flutter#13)
Also get rid of an outdated util method.
1 parent 5123d71 commit dfb94f3

File tree

5 files changed

+5
-23
lines changed

5 files changed

+5
-23
lines changed

lib/src/chain.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ class Chain implements StackTrace {
7777
};
7878
}
7979

80-
// TODO(rnystrom): Remove this cast if runZoned() gets a generic type.
81-
return runZoned(callback, onError: newOnError) as dynamic/*=T*/;
80+
return runZoned(callback, onError: newOnError);
8281
}
8382

8483
var spec = new StackZoneSpecification(onError);
@@ -207,7 +206,7 @@ class Chain implements StackTrace {
207206
// padding is consistent across all traces.
208207
return traces.map((trace) {
209208
return trace.frames.map((frame) {
210-
return '${padRight(frame.location, longest)} ${frame.member}\n';
209+
return '${frame.location.padRight(longest)} ${frame.member}\n';
211210
}).join();
212211
}).join(chainGap);
213212
}

lib/src/trace.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class Trace implements StackTrace {
291291
// Print out the stack trace nicely formatted.
292292
return frames.map((frame) {
293293
if (frame is UnparsedFrame) return "$frame\n";
294-
return '${padRight(frame.location, longest)} ${frame.member}\n';
294+
return '${frame.location.padRight(longest)} ${frame.member}\n';
295295
}).join();
296296
}
297297
}

lib/src/utils.dart

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,10 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:path/path.dart' as p;
6-
75
/// The line used in the string representation of stack chains to represent
86
/// the gap between traces.
97
const chainGap = '===== asynchronous gap ===========================\n';
108

119
// TODO(nweiz): When cross-platform imports work, use them to set this.
1210
/// Whether we're running in a JS context.
1311
final bool inJS = 0.0 is int;
14-
15-
/// Returns [string] with enough spaces added to the end to make it [length]
16-
/// characters long.
17-
String padRight(String string, int length) {
18-
if (string.length >= length) return string;
19-
20-
var result = new StringBuffer();
21-
result.write(string);
22-
for (var i = 0; i < length - string.length; i++) {
23-
result.write(' ');
24-
}
25-
26-
return result.toString();
27-
}

lib/src/vm_trace.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'frame.dart';
6-
import 'utils.dart';
76

87
/// An implementation of [StackTrace] that emulates the behavior of the VM's
98
/// implementation.
@@ -19,7 +18,7 @@ class VMTrace implements StackTrace {
1918
String toString() {
2019
var i = 1;
2120
return frames.map((frame) {
22-
var number = padRight("#${i++}", 8);
21+
var number = "#${i++}".padRight(8);
2322
var member = frame.member
2423
.replaceAllMapped(new RegExp(r"[^.]+\.<async>"),
2524
(match) => "${match[1]}.<${match[1]}_async_body>")

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: stack_trace
77
#
88
# When the major version is upgraded, you *must* update that version constraint
99
# in pub to stay in sync with this.
10-
version: 1.6.7
10+
version: 1.6.8-dev
1111
author: "Dart Team <[email protected]>"
1212
homepage: https://github.com/dart-lang/stack_trace
1313
description: >

0 commit comments

Comments
 (0)