Add types to TimelineSyncFunction and Timeline.timeSync; fixes #35509

Bug: https://github.com/dart-lang/sdk/issues/35509
Change-Id: I8bab1c1127d7a5021ff5698a4ae6be8c3730784e
Reviewed-on: https://dart-review.googlesource.com/c/92622
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Sam Rawlins 2019-02-11 21:35:57 +00:00 committed by commit-bot@chromium.org
parent 3de72ae066
commit 7ff0cbe8a3

View file

@ -8,7 +8,7 @@ const bool _hasTimeline =
const bool.fromEnvironment("dart.developer.timeline", defaultValue: true);
/// A typedef for the function argument to [Timeline.timeSync].
typedef dynamic TimelineSyncFunction();
typedef TimelineSyncFunction<T> = T Function();
// TODO: This typedef is not used.
typedef Future TimelineAsyncFunction();
@ -154,7 +154,7 @@ class Timeline {
/// A utility method to time a synchronous [function]. Internally calls
/// [function] bracketed by calls to [startSync] and [finishSync].
static dynamic timeSync(String name, TimelineSyncFunction function,
static T timeSync<T>(String name, TimelineSyncFunction<T> function,
{Map arguments, Flow flow}) {
startSync(name, arguments: arguments, flow: flow);
try {