Skip to content

Commit

Permalink
Fix analysis hints. (flutter#13)
Browse files Browse the repository at this point in the history
Also get rid of an outdated util method.
  • Loading branch information
nex3 authored Oct 4, 2016
1 parent 5123d71 commit dfb94f3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
5 changes: 2 additions & 3 deletions lib/src/chain.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ class Chain implements StackTrace {
};
}

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

var spec = new StackZoneSpecification(onError);
Expand Down Expand Up @@ -207,7 +206,7 @@ class Chain implements StackTrace {
// padding is consistent across all traces.
return traces.map((trace) {
return trace.frames.map((frame) {
return '${padRight(frame.location, longest)} ${frame.member}\n';
return '${frame.location.padRight(longest)} ${frame.member}\n';
}).join();
}).join(chainGap);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/trace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class Trace implements StackTrace {
// Print out the stack trace nicely formatted.
return frames.map((frame) {
if (frame is UnparsedFrame) return "$frame\n";
return '${padRight(frame.location, longest)} ${frame.member}\n';
return '${frame.location.padRight(longest)} ${frame.member}\n';
}).join();
}
}
16 changes: 0 additions & 16 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:path/path.dart' as p;

/// The line used in the string representation of stack chains to represent
/// the gap between traces.
const chainGap = '===== asynchronous gap ===========================\n';

// TODO(nweiz): When cross-platform imports work, use them to set this.
/// Whether we're running in a JS context.
final bool inJS = 0.0 is int;

/// Returns [string] with enough spaces added to the end to make it [length]
/// characters long.
String padRight(String string, int length) {
if (string.length >= length) return string;

var result = new StringBuffer();
result.write(string);
for (var i = 0; i < length - string.length; i++) {
result.write(' ');
}

return result.toString();
}
3 changes: 1 addition & 2 deletions lib/src/vm_trace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

import 'frame.dart';
import 'utils.dart';

/// An implementation of [StackTrace] that emulates the behavior of the VM's
/// implementation.
Expand All @@ -19,7 +18,7 @@ class VMTrace implements StackTrace {
String toString() {
var i = 1;
return frames.map((frame) {
var number = padRight("#${i++}", 8);
var number = "#${i++}".padRight(8);
var member = frame.member
.replaceAllMapped(new RegExp(r"[^.]+\.<async>"),
(match) => "${match[1]}.<${match[1]}_async_body>")
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: stack_trace
#
# When the major version is upgraded, you *must* update that version constraint
# in pub to stay in sync with this.
version: 1.6.7
version: 1.6.8-dev
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/stack_trace
description: >
Expand Down

0 comments on commit dfb94f3

Please sign in to comment.