| 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 | 797 |
| 798 @override | 798 @override |
| 799 js.Expression visitBinary(js.Binary node) { | 799 js.Expression visitBinary(js.Binary node) { |
| 800 if (shouldTransform(node.right) && (node.op == "||" || node.op == "&&")) { | 800 if (shouldTransform(node.right) && (node.op == "||" || node.op == "&&")) { |
| 801 int thenLabel = newLabel("then"); | 801 int thenLabel = newLabel("then"); |
| 802 int joinLabel = newLabel("join"); | 802 int joinLabel = newLabel("join"); |
| 803 withExpression(node.left, (js.Expression left) { | 803 withExpression(node.left, (js.Expression left) { |
| 804 js.Statement assignLeft = isResult(left) | 804 js.Statement assignLeft = isResult(left) |
| 805 ? new js.Block.empty() | 805 ? new js.Block.empty() |
| 806 : js.js.statement('# = #;', [result, left]); | 806 : js.js.statement('# = #;', [result, left]); |
| 807 if (node.op == "||") { | 807 if (node.op == "&&") { |
| 808 addStatement(js.js.statement('if (#) {#} else #', | 808 addStatement(js.js.statement('if (#) {#} else #', |
| 809 [left, gotoAndBreak(thenLabel), assignLeft])); | 809 [left, gotoAndBreak(thenLabel), assignLeft])); |
| 810 } else { | 810 } else { |
| 811 assert(node.op == "&&"); | 811 assert(node.op == "||"); |
| 812 addStatement(js.js.statement('if (#) {#} else #', | 812 addStatement(js.js.statement('if (#) {#} else #', |
| 813 [left, assignLeft, gotoAndBreak(thenLabel)])); | 813 [left, assignLeft, gotoAndBreak(thenLabel)])); |
| 814 } | 814 } |
| 815 }, store: true); | 815 }, store: true); |
| 816 addGoto(joinLabel); | 816 addGoto(joinLabel); |
| 817 beginLabel(thenLabel); | 817 beginLabel(thenLabel); |
| 818 withExpression(node.right, (js.Expression value) { | 818 withExpression(node.right, (js.Expression value) { |
| 819 if (!isResult(value)) { | 819 if (!isResult(value)) { |
| 820 addStatement(js.js.statement('# = #;', [result, value])); | 820 addStatement(js.js.statement('# = #;', [result, value])); |
| 821 } | 821 } |
| (...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2524 return condition || body; | 2524 return condition || body; |
| 2525 } | 2525 } |
| 2526 | 2526 |
| 2527 @override | 2527 @override |
| 2528 bool visitDartYield(js.DartYield node) { | 2528 bool visitDartYield(js.DartYield node) { |
| 2529 hasYield = true; | 2529 hasYield = true; |
| 2530 visit(node.expression); | 2530 visit(node.expression); |
| 2531 return true; | 2531 return true; |
| 2532 } | 2532 } |
| 2533 } | 2533 } |
| OLD | NEW |