Skip to content

Commit

Permalink
Merge pull request #26 from dart-lang/strong
Browse files Browse the repository at this point in the history
Fix all strong-mode warnings.
  • Loading branch information
nex3 committed May 2, 2016
2 parents 0444798 + 38dfabb commit a64e60a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .analysis_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
analyzer:
strong-mode: true
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.9.7+1

* Fix all strong-mode warnings.

# 0.9.7

* Fix a bug in `FileWatcher` where events could be added after watchers were
Expand Down
6 changes: 3 additions & 3 deletions lib/src/directory_watcher/linux.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class _LinuxDirectoryWatcher

/// The callback that's run when a batch of changes comes in.
void _onBatch(List<FileSystemEvent> batch) {
var files = new Set();
var dirs = new Set();
var changed = new Set();
var files = new Set<String>();
var dirs = new Set<String>();
var changed = new Set<String>();

// inotify event batches are ordered by occurrence, so we treat them as a
// log of what happened to a file. We only emit events based on the
Expand Down
11 changes: 7 additions & 4 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import 'dart:async';
import 'dart:io';
import 'dart:collection';

import 'package:async/async.dart';

/// Returns `true` if [error] is a [FileSystemException] for a missing
/// directory.
bool isDirectoryNotFoundException(error) {
Expand All @@ -29,17 +31,18 @@ Set unionAll(Iterable<Set> sets) =>
/// If [broadcast] is true, a broadcast stream is returned. This assumes that
/// the stream returned by [future] will be a broadcast stream as well.
/// [broadcast] defaults to false.
Stream futureStream(Future<Stream> future, {bool broadcast: false}) {
Stream/*<T>*/ futureStream/*<T>*/(Future<Stream/*<T>*/> future,
{bool broadcast: false}) {
var subscription;
StreamController controller;
StreamController/*<T>*/ controller;

future = future.catchError((e, stackTrace) {
future = DelegatingFuture.typed(future.catchError((e, stackTrace) {
// Since [controller] is synchronous, it's likely that emitting an error
// will cause it to be cancelled before we call close.
if (controller != null) controller.addError(e, stackTrace);
if (controller != null) controller.close();
controller = null;
});
}));

onListen() {
future.then((stream) {
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: watcher
version: 0.9.8-dev
version: 0.9.7+1
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/watcher
description: >
Expand All @@ -12,6 +12,7 @@ dependencies:
collection: '^1.0.0'
path: '>=0.9.0 <2.0.0'
dev_dependencies:
async: '^1.8.0'
benchmark_harness: '^1.0.4'
scheduled_test: '^0.12.0'
test: '^0.12.0'

0 comments on commit a64e60a

Please sign in to comment.