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

Unified Diff: tests/compiler/dart2js/async_await_js_transform_test.dart

Issue 1275003002: dart2js: Add a failing test case for the async rewriter. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comment. Created 5 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/async_await_js_transform_test.dart
diff --git a/tests/compiler/dart2js/async_await_js_transform_test.dart b/tests/compiler/dart2js/async_await_js_transform_test.dart
index 863f1c8805e3811a33a2021c4a6402053bc963e2..6e739740829642d407230eccbf739b6c8da94d01 100644
--- a/tests/compiler/dart2js/async_await_js_transform_test.dart
+++ b/tests/compiler/dart2js/async_await_js_transform_test.dart
@@ -44,6 +44,52 @@ void testSyncStarTransform(String source, String expected) {
}
main() {
+ testAsyncTransform( /// 01: ok
+r"""function() async {
+ var closures = [new A.main_closure()], v0 = await closures, v1 = 0, v2, v3;
+ if (v1 < 0 || v1 >= v0.length)
+ H.ioore(v0, v1);
+ v2 = 4;
+ v3 = 2;
+ P.print(v0[v1].call$2(v2, v3));
+}"""
+, /// 01: ok
+ r"""function() {
+ var __goto = 0, __completer = new Completer(), __handler = 1, __currentError, closures, v0, v1, v2, v3;
+ function body(__errorCode, __result) {
+ if (__errorCode === 1) {
+ __currentError = __result;
+ __goto = __handler;
+ }
+ while (true)
+ switch (__goto) {
+ case 0:
+ // Function start
+ __goto = 2;
+ closures = [new A.main_closure()];
+ return thenHelper(closures, body, __completer);
+ case 2:
+ // returning from await.
+ v0 = __result, v1 = 0;
+ if (v1 < 0 || v1 >= v0.length)
+ H.ioore(v0, v1);
+ else
+ ;
+ v2 = 4;
+ v3 = 2;
+ P.print(v0[v1].call$2(v2, v3));
+ // implicit return
+ return thenHelper(null, 0, __completer, null);
+ case 1:
+ // rethrow
+ return thenHelper(__currentError, 1, __completer);
+ }
+ }
+ return thenHelper(null, body, __completer, null);
+}"""
+ ) /// 01: ok
+ ;
+
testAsyncTransform("""
function(a) async {
print(this.x); // Ensure `this` is translated in the helper function.
« no previous file with comments | « no previous file | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698