| OLD | NEW |
| 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 library rewrite_async; | 5 library rewrite_async; |
| 6 | 6 |
| 7 import "dart:math" show max; | 7 import "dart:math" show max; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:_internal/compiler/js_lib/shared/async_await_error_codes.dart' | 10 import 'package:_internal/compiler/js_lib/shared/async_await_error_codes.dart' |
| (...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2405 bool visitReturn(js.Return node) { | 2405 bool visitReturn(js.Return node) { |
| 2406 hasExplicitReturns = true; | 2406 hasExplicitReturns = true; |
| 2407 targets[node] = currentFunction; | 2407 targets[node] = currentFunction; |
| 2408 if (node.value == null) return false; | 2408 if (node.value == null) return false; |
| 2409 return visit(node.value); | 2409 return visit(node.value); |
| 2410 } | 2410 } |
| 2411 | 2411 |
| 2412 @override | 2412 @override |
| 2413 bool visitSwitch(js.Switch node) { | 2413 bool visitSwitch(js.Switch node) { |
| 2414 loopsAndSwitches.add(node); | 2414 loopsAndSwitches.add(node); |
| 2415 bool result = visit(node.key); | 2415 // If the key has an `await` expression, do not transform the |
| 2416 // body of the switch. |
| 2417 visit(node.key); |
| 2418 bool result = false; |
| 2416 for (js.SwitchClause clause in node.cases) { | 2419 for (js.SwitchClause clause in node.cases) { |
| 2417 if (visit(clause)) result = true; | 2420 if (visit(clause)) result = true; |
| 2418 } | 2421 } |
| 2419 loopsAndSwitches.removeLast(); | 2422 loopsAndSwitches.removeLast(); |
| 2420 return result; | 2423 return result; |
| 2421 } | 2424 } |
| 2422 | 2425 |
| 2423 @override | 2426 @override |
| 2424 bool visitThis(js.This node) { | 2427 bool visitThis(js.This node) { |
| 2425 hasThis = true; | 2428 hasThis = true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 return condition || body; | 2479 return condition || body; |
| 2477 } | 2480 } |
| 2478 | 2481 |
| 2479 @override | 2482 @override |
| 2480 bool visitDartYield(js.DartYield node) { | 2483 bool visitDartYield(js.DartYield node) { |
| 2481 hasYield = true; | 2484 hasYield = true; |
| 2482 visit(node.expression); | 2485 visit(node.expression); |
| 2483 return true; | 2486 return true; |
| 2484 } | 2487 } |
| 2485 } | 2488 } |
| OLD | NEW |