commit | 53338adc9ed9c3de9d0330c92fb35a8cea4bf7bc | [log] [tgz] |
---|---|---|
author | Kevin Millikin <kmillikin@chromium.org> | Fri Jan 30 13:02:54 2015 |
committer | Kevin Millikin <kmillikin@chromium.org> | Fri Jan 30 13:02:54 2015 |
tree | 06e5a2153a798faecd3f243a59a61d7999108010 | |
parent | 8b401a9f2e5e81dca5f70dbe7564112a0823dee6 [diff] |
Handle failure of 'on T catch' clauses properly. 'on T catch' clauses are translated into if/else with explicit type tests. If all the tests fail the exception was thrown again, losing the stack trace from the original exception. Instead, use an explicit application of the error continuation (which we already know there's an await). This will either be a direct call to Completer.completeError with two arguments, or a call to a local catch handler function with two arguments.
A prototype (and in progress) implementation of async/await in Dart, via CPS translation.
This transformer is useful for trying async/await with dart2js. The Dart VM natively supports async and await. If you are writing Dart code that runs only in the VM, you do not need this transformer.
Add this to your pubspec.yaml file:
dependencies: async_await: git: https://github.com/dart-lang/async_await.git transformers: - async_await
Import dart:async in your Dart file:
import 'dart:async';
See also the open issues.