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

Side by Side Diff: tests/compiler/dart2js/async_await_js_transform_test.dart

Issue 994853003: Fix dart2js for switches in async code with only awaits in the key. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/compiler/lib/src/js/rewrite_async.dart ('k') | tests/language/async_switch_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "package:compiler/src/js/js.dart"; 6 import "package:compiler/src/js/js.dart";
7 import "package:compiler/src/js/rewrite_async.dart"; 7 import "package:compiler/src/js/rewrite_async.dart";
8 8
9 import "backend_dart/dart_printer_test.dart" show PrintDiagnosticListener; 9 import "backend_dart/dart_printer_test.dart" show PrintDiagnosticListener;
10 10
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 case 1: 1008 case 1:
1009 // return 1009 // return
1010 return thenHelper(__returnValue, 0, __completer, null); 1010 return thenHelper(__returnValue, 0, __completer, null);
1011 case 2: 1011 case 2:
1012 // rethrow 1012 // rethrow
1013 return thenHelper(__currentError, 1, __completer); 1013 return thenHelper(__currentError, 1, __completer);
1014 } 1014 }
1015 } 1015 }
1016 return thenHelper(null, __body, __completer, null); 1016 return thenHelper(null, __body, __completer, null);
1017 }"""); 1017 }""");
1018 testTransform("""
1019 function(l) async {
1020 switch(await l) {
1021 case 1:
1022 print(1);
1023 break;
1024 case 2:
1025 print(1);
1026 // Fallthrough
1027 default:
1028 print(2);
1029 break;
1030 }
1031 }""", """
1032 function(l) {
1033 var __goto = 0, __completer = new Completer(), __handler = 1, __currentError;
1034 function __body(__errorCode, __result) {
1035 if (__errorCode === 1) {
1036 __currentError = __result;
1037 __goto = __handler;
1038 }
1039 while (true)
1040 switch (__goto) {
1041 case 0:
1042 // Function start
1043 __goto = 2;
1044 return thenHelper(l, __body, __completer);
1045 case 2:
1046 // returning from await.
1047 switch (__result) {
1048 case 1:
1049 print(1);
1050 break;
1051 case 2:
1052 print(1);
1053 default:
1054 print(2);
1055 break;
1056 }
1057 // implicit return
1058 return thenHelper(null, 0, __completer, null);
1059 case 1:
1060 // rethrow
1061 return thenHelper(__currentError, 1, __completer);
1062 }
1063 }
1064 return thenHelper(null, __body, __completer, null);
1065 }""");
1018 } 1066 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js/rewrite_async.dart ('k') | tests/language/async_switch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698