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:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show max; | 8 import 'dart:math' show max; |
9 | 9 |
10 import 'package:js_runtime/shared/async_await_error_codes.dart' as error_codes; | 10 import 'package:js_runtime/shared/async_await_error_codes.dart' as error_codes; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 visitStatement(js.Statement node) { | 356 visitStatement(js.Statement node) { |
357 node.accept(this); | 357 node.accept(this); |
358 } | 358 } |
359 | 359 |
360 /// Visits [node] to ensure its sideeffects are performed, but throwing away | 360 /// Visits [node] to ensure its sideeffects are performed, but throwing away |
361 /// the result. | 361 /// the result. |
362 /// | 362 /// |
363 /// If the return value of visiting [node] is an expression guaranteed to have | 363 /// If the return value of visiting [node] is an expression guaranteed to have |
364 /// no side effect, it is dropped. | 364 /// no side effect, it is dropped. |
365 void visitExpressionIgnoreResult(js.Expression node) { | 365 void visitExpressionIgnoreResult(js.Expression node) { |
366 js.Expression result = node.accept(this); | 366 // TODO(28763): Remove `<dynamic>` when issue 28763 is fixed. |
| 367 js.Expression result = node.accept<dynamic>(this); |
367 if (!(result is js.Literal || result is js.VariableUse)) { | 368 if (!(result is js.Literal || result is js.VariableUse)) { |
368 addExpressionStatement(result); | 369 addExpressionStatement(result); |
369 } | 370 } |
370 } | 371 } |
371 | 372 |
372 js.Expression visitExpression(js.Expression node) { | 373 js.Expression visitExpression(js.Expression node) { |
373 return node.accept(this); | 374 // TODO(28763): Remove `<dynamic>` when issue 28763 is fixed. |
| 375 return node.accept<dynamic>(this); |
374 } | 376 } |
375 | 377 |
376 /// Calls [fn] with the value of evaluating [node1] and [node2]. | 378 /// Calls [fn] with the value of evaluating [node1] and [node2]. |
377 /// | 379 /// |
378 /// Both nodes are evaluated in order. | 380 /// Both nodes are evaluated in order. |
379 /// | 381 /// |
380 /// If node2 must be transformed (see [shouldTransform]), then the evaluation | 382 /// If node2 must be transformed (see [shouldTransform]), then the evaluation |
381 /// of node1 is added to the current statement-list and the result is stored | 383 /// of node1 is added to the current statement-list and the result is stored |
382 /// in a temporary variable. The evaluation of node2 is then free to emit | 384 /// in a temporary variable. The evaluation of node2 is then free to emit |
383 /// statements without affecting the result of node1. | 385 /// statements without affecting the result of node1. |
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2614 return condition || body; | 2616 return condition || body; |
2615 } | 2617 } |
2616 | 2618 |
2617 @override | 2619 @override |
2618 bool visitDartYield(js.DartYield node) { | 2620 bool visitDartYield(js.DartYield node) { |
2619 hasYield = true; | 2621 hasYield = true; |
2620 visit(node.expression); | 2622 visit(node.expression); |
2621 return true; | 2623 return true; |
2622 } | 2624 } |
2623 } | 2625 } |
OLD | NEW |