Disable implicit casts (#61)
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 7472eb0..3384ee6 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,3 +1,6 @@
+analyzer:
+ strong-mode:
+ implicit-casts: false
linter:
rules:
- prefer_equal_for_default_values
diff --git a/lib/src/chain.dart b/lib/src/chain.dart
index da6fb6f..3397f34 100644
--- a/lib/src/chain.dart
+++ b/lib/src/chain.dart
@@ -47,7 +47,8 @@
final List<Trace> traces;
/// The [StackZoneSpecification] for the current zone.
- static StackZoneSpecification get _currentSpec => Zone.current[_specKey];
+ static StackZoneSpecification get _currentSpec =>
+ Zone.current[_specKey] as StackZoneSpecification;
/// If [when] is `true`, runs [callback] in a [Zone] in which the current
/// stack chain is tracked and automatically associated with (most) errors.
@@ -81,7 +82,7 @@
}
if (!when) {
- var newOnError;
+ void Function(Object, StackTrace) newOnError;
if (onError != null) {
newOnError = (error, stackTrace) {
onError(
diff --git a/lib/src/frame.dart b/lib/src/frame.dart
index 752dcb7..ae19182 100644
--- a/lib/src/frame.dart
+++ b/lib/src/frame.dart
@@ -165,7 +165,7 @@
// v8 location strings can be arbitrarily-nested, since it adds a layer
// of nesting for each eval performed on that line.
- parseLocation(location, member) {
+ Frame parseLocation(String location, String member) {
var evalMatch = _v8EvalLocation.firstMatch(location);
while (evalMatch != null) {
location = evalMatch[1];
@@ -240,7 +240,7 @@
// Normally this is a URI, but in a jsshell trace it can be a path.
var uri = _uriOrPathToUri(match[3]);
- var member;
+ String member;
if (match[1] != null) {
member = match[1];
member +=
diff --git a/lib/src/stack_zone_specification.dart b/lib/src/stack_zone_specification.dart
index 4ef4eae..7420e0a 100644
--- a/lib/src/stack_zone_specification.dart
+++ b/lib/src/stack_zone_specification.dart
@@ -133,7 +133,7 @@
/// Tracks the current stack chain so it can be set to [_currentChain] when
/// [f] is run.
ZoneBinaryCallback<R, T1, T2> _registerBinaryCallback<R, T1, T2>(
- Zone self, ZoneDelegate parent, Zone zone, Function f) {
+ Zone self, ZoneDelegate parent, Zone zone, R Function(T1, T2) f) {
if (f == null || _disabled) return parent.registerBinaryCallback(zone, f);
var node = _createNode(1);
diff --git a/test/chain/dart2js_test.dart b/test/chain/dart2js_test.dart
index fbbad56..827c459 100644
--- a/test/chain/dart2js_test.dart
+++ b/test/chain/dart2js_test.dart
@@ -305,7 +305,7 @@
test(
'called for an unregistered stack trace returns a chain wrapping that '
'trace', () {
- var trace;
+ StackTrace trace;
var chain = Chain.capture(() {
try {
throw 'error';
@@ -324,7 +324,7 @@
test(
'forTrace() outside of capture() returns a chain wrapping the given '
'trace', () {
- var trace;
+ StackTrace trace;
var chain = Chain.capture(() {
try {
throw 'error';
diff --git a/test/chain/utils.dart b/test/chain/utils.dart
index c1f98e4..790693a 100644
--- a/test/chain/utils.dart
+++ b/test/chain/utils.dart
@@ -74,7 +74,7 @@
});
return completer.future
- .catchError((_, stackTrace) => Chain.forTrace(stackTrace));
+ .catchError((_, StackTrace stackTrace) => Chain.forTrace(stackTrace));
}
/// Runs [callback] in a [Chain.capture] zone and returns a Future that
diff --git a/test/chain/vm_test.dart b/test/chain/vm_test.dart
index c006d88..842f0a0 100644
--- a/test/chain/vm_test.dart
+++ b/test/chain/vm_test.dart
@@ -481,7 +481,7 @@
'chain', () {
// Disable the test package's chain-tracking.
return Chain.disable(() async {
- var trace;
+ StackTrace trace;
await Chain.capture(() async {
try {
throw 'error';