| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 kernel.transformations.async; | 5 library kernel.transformations.async; |
| 6 | 6 |
| 7 import '../kernel.dart'; | 7 import '../kernel.dart'; |
| 8 import 'continuation.dart'; | 8 import 'continuation.dart'; |
| 9 | 9 |
| 10 /// A transformer that introduces temporary variables for all subexpressions | 10 /// A transformer that introduces temporary variables for all subexpressions |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 /// helper functions, and yield points. Only the yield points need to be a | 41 /// helper functions, and yield points. Only the yield points need to be a |
| 42 /// statements, and they are statements so an implementation does not have to | 42 /// statements, and they are statements so an implementation does not have to |
| 43 /// handle unnamed expression intermediate live across yield points. | 43 /// handle unnamed expression intermediate live across yield points. |
| 44 /// | 44 /// |
| 45 /// The visit methods return the transformed expression and build a sequence | 45 /// The visit methods return the transformed expression and build a sequence |
| 46 /// of statements by emitting statements into this list. This list is built | 46 /// of statements by emitting statements into this list. This list is built |
| 47 /// in reverse because children are visited right-to-left. | 47 /// in reverse because children are visited right-to-left. |
| 48 /// | 48 /// |
| 49 /// If an expression should be named it is named before visiting its children | 49 /// If an expression should be named it is named before visiting its children |
| 50 /// so the naming assignment appears in the list before all statements | 50 /// so the naming assignment appears in the list before all statements |
| 51 /// implementating the translation of the children. | 51 /// implementing the translation of the children. |
| 52 /// | 52 /// |
| 53 /// Children that are conditionally evaluated, such as some parts of logical | 53 /// Children that are conditionally evaluated, such as some parts of logical |
| 54 /// and conditional expressions, must be delimited so that they do not emit | 54 /// and conditional expressions, must be delimited so that they do not emit |
| 55 /// unguarded statements into [statements]. This is implemented by setting | 55 /// unguarded statements into [statements]. This is implemented by setting |
| 56 /// [statements] to a fresh empty list before transforming those children. | 56 /// [statements] to a fresh empty list before transforming those children. |
| 57 List<Statement> statements = <Statement>[]; | 57 List<Statement> statements = <Statement>[]; |
| 58 | 58 |
| 59 /// The number of currently live named intermediate values. | 59 /// The number of currently live named intermediate values. |
| 60 /// | 60 /// |
| 61 /// This index is used to allocate names to temporary values. Because | 61 /// This index is used to allocate names to temporary values. Because |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 }); | 482 }); |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 | 485 |
| 486 visitFunctionNode(FunctionNode node) { | 486 visitFunctionNode(FunctionNode node) { |
| 487 var nestedRewriter = | 487 var nestedRewriter = |
| 488 new RecursiveContinuationRewriter(continuationRewriter.helper); | 488 new RecursiveContinuationRewriter(continuationRewriter.helper); |
| 489 return node.accept(nestedRewriter); | 489 return node.accept(nestedRewriter); |
| 490 } | 490 } |
| 491 } | 491 } |
| OLD | NEW |