Chromium Code Reviews| Index: corelib/src/implementation/future_implementation.dart |
| diff --git a/corelib/src/implementation/future_implementation.dart b/corelib/src/implementation/future_implementation.dart |
| index f2d73a337f7563922bd62c5f186fd6634a5471c3..88cd0f24134708712b54d654c95eee4be1e2a760 100644 |
| --- a/corelib/src/implementation/future_implementation.dart |
| +++ b/corelib/src/implementation/future_implementation.dart |
| @@ -1,9 +1,9 @@ |
| -// Copyright 2011 Google Inc. All Rights Reserved. |
| +// Copyright 2012 Google Inc. All Rights Reserved. |
| // Dart core library. |
| class FutureImpl<T> implements Future<T> { |
| - bool _isComplete; |
| + bool _isComplete = false; |
| /** |
| * Value that was provided to this Future by the Completer |
| @@ -19,7 +19,7 @@ class FutureImpl<T> implements Future<T> { |
| /** |
| * true, if any onException handler handled the exception. |
| */ |
| - bool _exceptionHandled; |
| + bool _exceptionHandled = false; |
|
Siggi Cherem (dart-lang)
2012/04/27 22:32:51
yay!
|
| /** |
| * Listeners waiting to receive the value of this future. |
| @@ -31,10 +31,9 @@ class FutureImpl<T> implements Future<T> { |
| */ |
| final List<Function> _exceptionHandlers; |
| - FutureImpl() : _listeners = new List(), _exceptionHandlers = new List() { |
| - _isComplete = false; |
| - _exceptionHandled = false; |
| - } |
| + FutureImpl() |
| + : _listeners = [], |
| + _exceptionHandlers = []; |
| factory FutureImpl.immediate(T value) { |
| final res = new FutureImpl(); |
| @@ -92,12 +91,15 @@ class FutureImpl<T> implements Future<T> { |
| _isComplete = true; |
| if (_exception !== null) { |
| for (Function handler in _exceptionHandlers) { |
| - if (handler(_exception)) { |
| + // Explicitly check for true here so that if the handler returns null, |
|
Siggi Cherem (dart-lang)
2012/04/27 22:32:51
booo! :(
|
| + // we don't get an exception in checked mode. |
| + if (handler(_exception) == true) { |
| _exceptionHandled = true; |
| break; |
| } |
| } |
| } |
| + |
| if (hasValue) { |
| for (Function listener in _listeners) { |
| listener(value); |