Lasse R.H. Nielsen
06676c4719
Implement everything in test Future-class to avoid analyzer warnings.
...
Review URL: https://codereview.chromium.org/1968033002 .
2016-05-11 13:43:51 +02:00
Lasse R.H. Nielsen
63b71b4c24
Make _Future._chainForeignFuture not cause an assert.
...
If the foreign future completes with a future, the following call to
_Future._completeWithValue would hit an assert in checked mode
(value is! Future). This change makes the _Future._completeWithValue flatten
incoming nesting futures before completing the _Future, ensuring that a
_Future never has a Future as value.
An alternative is to throw if the value of a future is another future.
That's what the assert does in checked mode, but we shouldn't be able to hit
an assert.
R=floitsch@google.com
Review URL: https://codereview.chromium.org/1966523003 .
2016-05-11 13:10:46 +02:00
Florian Loitsch
257272fd42
Use internal const-constructor.
...
BUG= http://dartbug.com/25760
R=lrn@google.com
Review URL: https://codereview.chromium.org/1696453002 .
2016-02-12 20:29:41 +01:00
Todd Turnidge
be3acab294
Use Stopwatch instead of DateTime to measure elapsed time in tests.
...
Improve timer_repeat_test.dart to not totally punt on testing the timing.
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1683233003 .
2016-02-10 11:21:40 -08:00
Florian Loitsch
963f653b12
Make generic type of timeout-future the same as the one from the original.
...
R=lrn@google.com
Review URL: https://codereview.chromium.org//1299443002 .
2016-02-09 18:57:25 +01:00
Lasse R.H. Nielsen
8487d57e48
Add Future.any and Stream.fromFutures.
...
R=floitsch@google.com
Review URL: https://codereview.chromium.org/1563223002 .
2016-01-08 10:17:34 +01:00
Lasse R.H. Nielsen
5363e5c945
Make dart2js code retain the original stack trace for uncaught async errors.
...
R=sigmund@google.com
Review URL: https://codereview.chromium.org/1383213002 .
2015-11-17 15:17:04 +01:00
Lasse R.H. Nielsen
5009e57524
If computation of Stream.periodic throws, forward the error to the stream.
...
Fixes issue #24766
BUG= http://dartbug.com/24766
R=floitsch@google.com
Review URL: https://codereview.chromium.org/1415533015 .
2015-11-04 10:27:49 +01:00
Florian Schneider
eb3186b7bd
Fix flaky async test.
...
Replacing > with >= since finishing in 10 to 11 ms is to be expected.
BUG=dartbug.com/24788
R=floitsch@google.com
Review URL: https://codereview.chromium.org/1415413012 .
2015-11-03 23:30:00 +01:00
Florian Loitsch
debf1d6f7c
Don't zone-register async callbacks for every await call in the VM.
...
This has the nice side-effect that the stack_trace package provides nicer chains.
Fixes issue 23394.
R=hausner@google.com
Committed: https://github.com/dart-lang/sdk/commit/4dae43d63727268f2e0cc45d6020246eb49177b8
Reverted: https://github.com/dart-lang/sdk/commit/cb4f9fc925c5a92c6cf756751e38296383f66507
Review URL: https://codereview.chromium.org//1274133002 .
2015-08-17 19:26:50 +02:00
Florian Loitsch
cb4f9fc925
Revert "Don't zone-register async callbacks for every await call in the VM."
...
This reverts commit 4dae43d637 .
Review URL: https://codereview.chromium.org//1296973002 .
2015-08-17 16:43:35 +02:00
Florian Loitsch
4dae43d637
Don't zone-register async callbacks for every await call in the VM.
...
This has the nice side-effect that the stack_trace package provides nicer chains.
Fixes issue 23394.
R=hausner@google.com
Review URL: https://codereview.chromium.org//1274133002 .
2015-08-17 15:58:19 +02:00
Florian Loitsch
410b181e13
The return-value of 'asFuture' isn't necessarily related to the Stream's type.
...
R=lrn@google.com
Review URL: https://codereview.chromium.org//1295843002 .
2015-08-17 14:44:31 +02:00
Florian Loitsch
00aaf1708d
Accept a computation that returns a Future for Future.delayed.
...
R=lrn@google.com
Review URL: https://codereview.chromium.org//1296623004 .
2015-08-17 11:34:43 +02:00
Florian Loitsch
f2d08149fd
Don't delay values and errors from async/await functions.
...
Fixes issue 23497.
R=hausner@google.com
Review URL: https://codereview.chromium.org//1287673002 .
2015-08-13 13:00:11 +02:00
Florian Loitsch
ad38b75bb2
Forward cancel subscription in stream pipes.
...
R=lrn@google.com
Review URL: https://codereview.chromium.org//1284223005 .
2015-08-13 12:57:35 +02:00
Lasse R.H. Nielsen
e9f48a37e8
Add getters for callbacks on StreamController.
...
R=floitsch@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//1278873008 .
2015-08-11 10:55:48 +02:00
Lasse R.H. Nielsen
0a35f7be3b
Update Changelog.
...
Fix various typos and style nits.
BUG=23961
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//1272593002 .
2015-08-05 12:58:30 +02:00
Lasse R.H. Nielsen
ac33dfe194
Fix missing generic type parameters on streams.
...
Add test.
BUG= 23859
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//1250373007 .
2015-08-03 14:21:17 +02:00
Lasse R.H. Nielsen
4a8a844c34
Add setters for callbacks on StreamController.
...
This allows you to create a stream controller at one point and
add or change the callbacks later. This can be useful if you
want to store a stream controller in a final instance field and
also want the controller to call instance methods as callbacks.
R=floitsch@google.com
Review URL: https://codereview.chromium.org//1242023007 .
2015-07-17 12:03:00 +02:00
Lasse R.H. Nielsen
f529055c1b
Update documentation of StreamIterator, improve tests.
...
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//1216123004 .
2015-07-03 13:23:39 +02:00
Lasse R.H. Nielsen
80960767e9
Fix timing issue in stream_empty_test, and make analyzer expect it to pass.
...
Review URL: https://codereview.chromium.org//1188613008 .
2015-06-16 13:33:53 +02:00
Lasse R.H. Nielsen
fbedc2b86f
Also iprove Future.value(null) and documentation of some Stream related classes.
...
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//1177343004 .
2015-06-16 11:38:07 +02:00
floitsch@google.com
f4a1b28077
Move isolate tests to lib/isolate.
...
Moves most tests that require dart:isolate to the isolate-directory in the tests section.
Also enables the string_from_environment_default_value_test which didn't have "_test" in its name.
R=lrn@google.com
Review URL: https://codereview.chromium.org//1133983002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45701 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 17:59:51 +00:00
lrn@google.com
312a21cc1a
Make Completer.complete handle a Future with a misbehaving "then" call.
...
Instead of throwing and getting into an invalid state (isChained but won't ever
complete), the synchronous error from trying to call "then" is used to complete
the future.
This should never happen in practice - it requires a "then" implementation that
is missing or throwing even when given valid arguments.
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//1025133004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44629 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-23 09:09:32 +00:00
floitsch@google.com
7d6fa5fa38
Give test more time.
...
If a program is really slow, there might be some time before the next line is executed.
Apparently 1s is not enough.
In theory setTimeouts are supposed to be executed in the right order:
https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowtimers-settimeout
Review URL: https://codereview.chromium.org//994013002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44372 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-10 14:48:31 +00:00
iposva@google.com
4b1ba9eb69
- Make sure we schedule another wakeup when handling a timeout
...
from the event handler.
Review URL: https://codereview.chromium.org//971193002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44191 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-03 19:14:30 +00:00
lrn@google.com
1f6d0e4f86
Make synchronous broadcast StreamController throw if adding event while adding event.
...
It already throws if there is more than one listener, but this change
also makes it throw if there is only one listener, for consistency.
Also add SynchronousStreamController abstract class.
It only contains documentation for synchronous stream controllers.
BUG= http://dartbug.com/22240
R=floitsch@google.com
Review URL: https://codereview.chromium.org//882713009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43946 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-23 10:36:58 +00:00
lrn@google.com
34cc8411a3
Fix behavior when listening multiple times to a broadcast take/skip stream.
...
Turns out the existing behavior was badly broken.
A broadcastStream.take(10) would only produce ten events total, no matter how
many listeners were attached, beacuse the counter was on the stream, not the
subscription.
R=floitsch@google.com
Review URL: https://codereview.chromium.org//920373003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43755 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-13 13:59:41 +00:00
sigurdm@google.com
a636a3c5a2
Change timer delay to 0 to make jsshell happy.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//903433002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43464 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 12:11:40 +00:00
sigurdm@google.com
0187b8144a
Avoid crashing when a closed StreamIterator is cancelled
...
BUG=
R=floitsch@google.com , lrn@google.com
Review URL: https://codereview.chromium.org//896793002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43460 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 11:23:27 +00:00
lrn@google.com
3a66c29a6d
Add cleanUp function to Future.wait.
...
The cleanUp function is called on the values of successful futures,
so it can release any resources that were successfully allocated.
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//815773002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42730 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-09 10:52:15 +00:00
lrn@google.com
181efd76ee
Add missing null-tests to async error functions.
...
Also treat null errors comming out of Zone.errorCallback as
NullThrownError.
This should prevent, as was always the intention, any async error
from having a null value.
This is important for async/await syntax, where the distinction
between sync and async errors is removed.
(For Dart 2.0, we could just make null throwable).
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//598993002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40673 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-25 11:00:49 +00:00
lrn@google.com
602f73b4a2
Add error-intercept for Completer.completeError and StreamController.addError.
...
BUG= http://dartbug.com/15105
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//555153002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40308 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-16 10:51:01 +00:00
sigurdm@google.com
457c8c33c7
Remove support for the DeferredLibrary annotation and remove tests of it
...
BUG= 18562
R=floitsch@google.com , hausner@google.com
Review URL: https://codereview.chromium.org//429883002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39797 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-03 08:34:34 +00:00
floitsch@google.com
7de52b638e
Don't consider controller.addError to be a zone-crossing.
...
BUG= http://dartbug.com/18776
R=lrn@google.com
Review URL: https://codereview.chromium.org//366813005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38120 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-10 13:51:03 +00:00
lrn@google.com
2b8981c436
Fix listeners being added to subscription after onListen was called.
...
BUG= http://dartbug.com/19722
R=floitsch@google.com , sgjesse@google.com
Review URL: https://codereview.chromium.org//357283003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37847 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-01 07:14:19 +00:00
lrn@google.com
f9b8b18ab8
Rewrite Zone implementation to avoid recursively looking up stuff in the parent chain.
...
Reuses as much as possible of the parent zone's implementation representation.
Increases performance of primitive tests of only async operations by ~10% (but with a lot of variability and a spurious regression).
R=floitsch@google.com
Review URL: https://codereview.chromium.org//331993005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37807 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-30 07:26:01 +00:00
nweiz@google.com
b71b5adb62
Add Future.doWhile to dart:async.
...
This makes both Future.doWhile and Future.forEach interact more
intuitively with zones. It also explicitly allows the callback to
Future.forEach to return a non-Future value.
BUG=http://dartbug.com/19645 , http://dartbug.com/19646
RELNOTE=Add Future.doWhile and allow Future.forEach's callback to return a non-Future.
R=lrn@google.com
Review URL: https://codereview.chromium.org//356773005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37750 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-26 19:53:38 +00:00
lrn@google.com
f3dd052a54
Fix typo in _DoneStreamSubscription.asFuture.
...
Add usage to test.
Review URL: https://codereview.chromium.org//304353016
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36865 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-02 11:15:34 +00:00
lrn@google.com
5cbd1e05e2
Update documentation for "close" and fix subscription returned by closed broadcast streams.
...
The close method on StreamConsumer, StreamSink and StreamController do not explain
the returned future or say when it is completed.
Listening on a closed broadcast stream should not throw, but just give a subscription that sends a done asap.
BUG= http://dartbug.com/19095
R=ajohnsen@google.com
Review URL: https://codereview.chromium.org//301193010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36862 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-02 11:03:24 +00:00
lrn@google.com
de280d96af
Make Stream.where, etc., be documented as inheriting broadcast state.
...
Very few changes were necessary because it was already the behavior in most
cases.
BUG= http://dartbug.com/18586
R=ajohnsen@google.com
Committed: https://code.google.com/p/dart/source/detail?r=36344
Review URL: https://codereview.chromium.org//295913003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36475 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-22 08:44:21 +00:00
lrn@google.com
55d24213f6
Revert "Make Stream.where, etc., be documented as inheriting broadcast state."
...
There were ... complications.
Review URL: https://codereview.chromium.org//299623003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36347 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 08:30:34 +00:00
lrn@google.com
33bcf9755c
Make Stream.where, etc., be documented as inheriting broadcast state.
...
Very few changes were necessary because it was already the behavior in most
cases.
BUG= http://dartbug.com/18586
R=ajohnsen@google.com
Review URL: https://codereview.chromium.org//295913003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36344 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-20 07:28:12 +00:00
lrn@google.com
35466f1e8b
Fix typo in test.
...
Throwing the wrong exception - which was being overruled by a later
exception anyway.
Review URL: https://codereview.chromium.org//271273005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36022 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-12 10:18:37 +00:00
lrn@google.com
f4fc2fc632
Make errors from StreamController onCancel calls end up in the returned future.
...
This changes errors happening in an onCancel callback from being uncaught
async errors (captured by zone.runGuarded) to being put into the result
future every time.
It already happens if the onCancel returns a future containing an error,
but if onCancel throws itself, it was different. This makes onCancel
act the same whether it fails immediately or asynchronously.
It should not change the behavior of current working programs:
an uncaught error would likely terminate the program, and the returned
futures are not checked for errors.
After the change, the error will reach the future and become uncaught there
instead, still terminating the program in the same way.
R=ajohnsen@google.com , floitsch@google.com
Review URL: https://codereview.chromium.org//269283007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36021 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-12 09:48:31 +00:00
lrn@google.com
2ab1f1238f
Trying to make preamble for d8.
...
Preamble handles timers and task queue.
R=floitsch@google.com
Review URL: https://codereview.chromium.org//201873002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34967 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-11 10:29:06 +00:00
sigurdm@google.com
dc92146b57
Load deferred chunks in the right order.
...
A chunk can depend on classes in shared chunks. Therefore sort they are
sorted, and loaded sequentially.
BUG= dartbug.com/17890
R=floitsch@google.com
Committed: https://code.google.com/p/dart/source/detail?r=34698
Reverted: r34702
Review URL: https://codereview.chromium.org//221663005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34915 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 08:48:11 +00:00
sigurdm@google.com
9150d1ce0c
Revert "Load deferred chunks in the right order."
...
This reverts commit 34698.
Review URL: https://codereview.chromium.org//223373004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34702 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-03 12:47:20 +00:00
sigurdm@google.com
22d8c97cd2
Load deferred chunks in the right order.
...
A chunk can depend on classes in shared chunks. Therefore sort they are
sorted, and loaded sequentially.
BUG= dartbug.com/17890
R=floitsch@google.com
Review URL: https://codereview.chromium.org//221663005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34698 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-03 12:15:18 +00:00