Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: corelib/src/implementation/future_implementation.dart

Issue 8387015: add initialization of _exceptionHandled in FutureImplementation.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 Google Inc. All Rights Reserved. 1 // Copyright 2011 Google Inc. All Rights Reserved.
2 // Dart core library. 2 // Dart core library.
3 3
4 /** 4 /**
5 * Thrown if client tries to obtain value or exception 5 * Thrown if client tries to obtain value or exception
6 * before a future has completed. 6 * before a future has completed.
7 */ 7 */
8 class FutureNotCompleteException implements Exception { 8 class FutureNotCompleteException implements Exception {
9 FutureNotCompleteException() {} 9 FutureNotCompleteException() {}
10 } 10 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 */ 43 */
44 final List<Function> _listeners; 44 final List<Function> _listeners;
45 45
46 /** 46 /**
47 * Exception handlers waiting for exceptions. 47 * Exception handlers waiting for exceptions.
48 */ 48 */
49 final List<Function> _exceptionHandlers; 49 final List<Function> _exceptionHandlers;
50 50
51 FutureImpl() : _listeners = new List(), _exceptionHandlers = new List() { 51 FutureImpl() : _listeners = new List(), _exceptionHandlers = new List() {
52 _isComplete = false; 52 _isComplete = false;
53 _exceptionHandled = false;
53 } 54 }
54 55
55 T get value() { 56 T get value() {
56 if (!isComplete) { 57 if (!isComplete) {
57 throw new FutureNotCompleteException(); 58 throw new FutureNotCompleteException();
58 } 59 }
59 if (_exception != null) { 60 if (_exception != null) {
60 throw _exception; 61 throw _exception;
61 } 62 }
62 return _value; 63 return _value;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 142 }
142 143
143 void complete(T value) { 144 void complete(T value) {
144 _futureImpl._setValue(value); 145 _futureImpl._setValue(value);
145 } 146 }
146 147
147 void completeException(var exception) { 148 void completeException(var exception) {
148 _futureImpl._setException(exception); 149 _futureImpl._setException(exception);
149 } 150 }
150 } 151 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698