Update to use strong-mode clean Zone API.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e6b5ff..19fb82b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.8.2
+
+* Update to use strong-mode clean Zone API.
+
## 1.8.1
* Use official generic function syntax.
diff --git a/lib/src/chain.dart b/lib/src/chain.dart
index 07966fc..01bf06f 100644
--- a/lib/src/chain.dart
+++ b/lib/src/chain.dart
@@ -93,7 +93,8 @@
return callback();
} catch (error, stackTrace) {
// TODO(nweiz): Don't special-case this when issue 19566 is fixed.
- return Zone.current.handleUncaughtError(error, stackTrace);
+ Zone.current.handleUncaughtError(error, stackTrace);
+ return null;
}
},
zoneSpecification: spec.toSpec(),
diff --git a/lib/src/stack_zone_specification.dart b/lib/src/stack_zone_specification.dart
index eb06beb..6749d56 100644
--- a/lib/src/stack_zone_specification.dart
+++ b/lib/src/stack_zone_specification.dart
@@ -92,8 +92,8 @@
/// Tracks the current stack chain so it can be set to [_currentChain] when
/// [f] is run.
- ZoneCallback _registerCallback(
- Zone self, ZoneDelegate parent, Zone zone, Function f) {
+ ZoneCallback<R> _registerCallback<R>(
+ Zone self, ZoneDelegate parent, Zone zone, R f()) {
if (f == null || _disabled) return parent.registerCallback(zone, f);
var node = _createNode(1);
return parent.registerCallback(zone, () => _run(f, node));
@@ -101,8 +101,8 @@
/// Tracks the current stack chain so it can be set to [_currentChain] when
/// [f] is run.
- ZoneUnaryCallback _registerUnaryCallback(
- Zone self, ZoneDelegate parent, Zone zone, Function f) {
+ ZoneUnaryCallback<R, T> _registerUnaryCallback<R, T>(
+ Zone self, ZoneDelegate parent, Zone zone, R f(T arg)) {
if (f == null || _disabled) return parent.registerUnaryCallback(zone, f);
var node = _createNode(1);
return parent.registerUnaryCallback(zone, (arg) {
@@ -112,7 +112,7 @@
/// Tracks the current stack chain so it can be set to [_currentChain] when
/// [f] is run.
- ZoneBinaryCallback _registerBinaryCallback(
+ ZoneBinaryCallback<R, T1, T2> _registerBinaryCallback<R, T1, T2>(
Zone self, ZoneDelegate parent, Zone zone, Function f) {
if (f == null || _disabled) return parent.registerBinaryCallback(zone, f);
@@ -124,26 +124,28 @@
/// Looks up the chain associated with [stackTrace] and passes it either to
/// [_onError] or [parent]'s error handler.
- _handleUncaughtError(
+ void _handleUncaughtError(
Zone self, ZoneDelegate parent, Zone zone, error, StackTrace stackTrace) {
if (_disabled) {
- return parent.handleUncaughtError(zone, error, stackTrace);
+ parent.handleUncaughtError(zone, error, stackTrace);
+ return;
}
var stackChain = chainFor(stackTrace);
if (_onError == null) {
- return parent.handleUncaughtError(zone, error, stackChain);
+ parent.handleUncaughtError(zone, error, stackChain);
+ return;
}
// TODO(nweiz): Currently this copies a lot of logic from [runZoned]. Just
// allow [runBinary] to throw instead once issue 18134 is fixed.
try {
- return self.parent.runBinary(_onError, error, stackChain);
+ self.parent.runBinary(_onError, error, stackChain);
} catch (newError, newStackTrace) {
if (identical(newError, error)) {
- return parent.handleUncaughtError(zone, error, stackChain);
+ parent.handleUncaughtError(zone, error, stackChain);
} else {
- return parent.handleUncaughtError(zone, newError, newStackTrace);
+ parent.handleUncaughtError(zone, newError, newStackTrace);
}
}
}
@@ -180,7 +182,7 @@
///
/// If [f] throws an error, this associates [node] with that error's stack
/// trace.
- _run(Function f, _Node node) {
+ T _run<T>(T f(), _Node node) {
var previousNode = _currentNode;
_currentNode = node;
try {
diff --git a/pubspec.yaml b/pubspec.yaml
index 3aca7a7..a6e5b92 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -7,7 +7,7 @@
#
# When the major version is upgraded, you *must* update that version constraint
# in pub to stay in sync with this.
-version: 1.8.1
+version: 1.8.2
author: "Dart Team <misc@dartlang.org>"
homepage: https://github.com/dart-lang/stack_trace
description: A package for manipulating stack traces and printing them readably.