| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** | 5 /** |
| 6 * Traverses the entire code of a function to find whether it contains awaits, | 6 * Traverses the entire code of a function to find whether it contains awaits, |
| 7 * ensuring they occur only in valid locations. This visitor will *not* recurse | 7 * ensuring they occur only in valid locations. This visitor will *not* recurse |
| 8 * inside nested function declarations. | 8 * inside nested function declarations. |
| 9 */ | 9 */ |
| 10 class AwaitChecker implements TreeVisitor { | 10 class AwaitChecker implements TreeVisitor { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 | 300 |
| 301 visitThisExpression(ThisExpression node) { | 301 visitThisExpression(ThisExpression node) { |
| 302 return false; | 302 return false; |
| 303 } | 303 } |
| 304 | 304 |
| 305 visitSuperExpression(SuperExpression node) { | 305 visitSuperExpression(SuperExpression node) { |
| 306 return false; | 306 return false; |
| 307 } | 307 } |
| 308 | 308 |
| 309 visitNullExpression(NullExpression node) { | 309 visitStringInterpExpression(StringInterpExpression node) { |
| 310 return false; | 310 return false; |
| 311 } | 311 } |
| 312 | 312 |
| 313 visitLiteralExpression(LiteralExpression node) { | 313 visitLiteralExpression(LiteralExpression node) { |
| 314 return false; | 314 return false; |
| 315 } | 315 } |
| 316 | 316 |
| 317 visitArgumentNode(ArgumentNode node) { | 317 visitArgumentNode(ArgumentNode node) { |
| 318 bool awaitSeen = node.value.visit(this); | 318 bool awaitSeen = node.value.visit(this); |
| 319 if (awaitSeen) haveAwait.add(node); | 319 if (awaitSeen) haveAwait.add(node); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 return awaitSeen; | 362 return awaitSeen; |
| 363 } | 363 } |
| 364 | 364 |
| 365 _visit(node) { | 365 _visit(node) { |
| 366 if (node == null) return false; | 366 if (node == null) return false; |
| 367 return node.visit(this); | 367 return node.visit(this); |
| 368 } | 368 } |
| 369 } | 369 } |
| OLD | NEW |