Commit graph

11 commits

Author SHA1 Message Date
Stephen Adams bfd71ad330 Test for yield* of Iterable with throwing get:iterator
DDC passes, dart2js and VM fail.

----

The dart2js and VM fringe-following scheme could be modified to call
`.iterator` at the `yield*` site and use the Iterator instead of the Iterable.
Calling `.iterator` at the `yield*` site  would move the exception to the right place. It might also present an optimization opportunity where  the call might be inlined, or the entry into the fringe-following algorithm could be made more efficient based on the type of the iterator.

Change-Id: Icfb6f7ca0b92cbeea1349ce138e469cfa707f571
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295200
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-04-14 22:04:28 +00:00
Stephen Adams a34719fdb9 Add test for yield* of iterator with throwing get:current
Change-Id: Idafa467a5e196d2351b3e5989177b39e959fddc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294882
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-04-13 17:34:58 +00:00
Stephen Adams e9529d1841 Add test for moving past end of sync* iterator
Change-Id: I4dd80cd7fc5875cb0d677f45683e3a2652165cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294163
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-04-11 18:58:42 +00:00
Josh Soref 17ccbecc61 Spelling tests language
Closes https://github.com/dart-lang/sdk/pull/50763

GitOrigin-RevId: ee6187bc11c8211402b6aa722eb2c0826cba3d5b
Change-Id: I598004024a89e25710b9f16749ffb7c6fd6753c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276340
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2022-12-19 16:30:06 +00:00
Clement Skau c486a07b02 [VM] Fixes yield* exception handling in sync*.
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.

Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I054b9db568a49b046b6bb49f3e775bf093f83950
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160221
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-10-27 06:46:27 +00:00
Clement Skau 90652bc314 [VM] Fixes nested sync* w. diff. types.
Makes the synthetic sync* iterator dynamic to allow the internal,
synthetic sync* code to handle nested iterators of differing types.

Bug: https://github.com/dart-lang/sdk/issues/42234
Change-Id: I309885b27555142cd7f8ab13a5637b35545f1d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160071
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-09-03 11:48:44 +00:00
Clement Skau 4db081545e Revert "[VM] Fixes yield* exception handling in sync*."
This reverts commit 358aee331b.

Reason for revert: Appears to break service/async_generator_breakpoint_test

Original change's description:
> [VM] Fixes yield* exception handling in sync*.
> 
> This adds a mechanism similar to that used in async functions where
> exceptions are caught in the synthetic code and passed into the
> generated body to be rethrow'n.
> This ensures the exception is throw'n from the same place as the
> original yield*, as per the spec.
> 
> Bug: https://github.com/dart-lang/sdk/issues/42466
> Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I9df83543d41d4260e91e4a7fb8df7c2762b92429
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/42466
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160101
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-08-25 14:08:42 +00:00
Clement Skau 358aee331b [VM] Fixes yield* exception handling in sync*.
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.

Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-08-25 12:40:49 +00:00
Konstantin Shcheglov 8de8a1c226 Move codes from StaticTypeWarningCode into CompileTimeErrorCode.
They are all errors now.

Change-Id: If48d38e38e845fd5b5a950dd5514bf1cbbce03d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-27 16:44:15 +00:00
Erik Ernst 4743211d04 Add new tests, cf. #1060 (void generators)
Change-Id: I7a2bcc85731e426c6d0073d65c06878f917d6627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154681
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-07-16 14:07:13 +00:00
Robert Nystrom 7e5fe50b24 Migrate language_2/sync_star to NNBD.
Change-Id: I184c984b65f15dabc647c510295c3dc82be3a203
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151473
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2020-06-17 02:25:41 +00:00