OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of native; | 5 part of native; |
6 | 6 |
| 7 |
| 8 class HasCapturedPlaceholders extends js.BaseVisitor { |
| 9 |
| 10 HasCapturedPlaceholders._(); |
| 11 |
| 12 static bool check(js.Node node) { |
| 13 HasCapturedPlaceholders visitor = new HasCapturedPlaceholders._(); |
| 14 node.accept(visitor); |
| 15 return visitor.found; |
| 16 } |
| 17 |
| 18 int enclosingFunctions = 0; |
| 19 bool found = false; |
| 20 |
| 21 @override |
| 22 visitFun(js.Fun node) { |
| 23 ++enclosingFunctions; |
| 24 node.visitChildren(this); |
| 25 --enclosingFunctions; |
| 26 } |
| 27 |
| 28 @override |
| 29 visitInterpolatedNode(js.InterpolatedNode node) { |
| 30 if (enclosingFunctions > 0) { |
| 31 found = true; |
| 32 } |
| 33 } |
| 34 } |
| 35 |
7 class SideEffectsVisitor extends js.BaseVisitor { | 36 class SideEffectsVisitor extends js.BaseVisitor { |
8 final SideEffects sideEffects; | 37 final SideEffects sideEffects; |
9 SideEffectsVisitor(this.sideEffects); | 38 SideEffectsVisitor(this.sideEffects); |
10 | 39 |
11 void visit(js.Node node) { | 40 void visit(js.Node node) { |
12 node.accept(this); | 41 node.accept(this); |
13 } | 42 } |
14 | 43 |
15 void visitLiteralExpression(js.LiteralExpression node) { | 44 void visitLiteralExpression(js.LiteralExpression node) { |
16 sideEffects.setAllSideEffects(); | 45 sideEffects.setAllSideEffects(); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 receiver.isPositional && | 289 receiver.isPositional && |
261 receiver.nameOrPosition == 0) { | 290 receiver.nameOrPosition == 0) { |
262 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; | 291 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; |
263 } else { | 292 } else { |
264 first = NativeThrowBehavior.MAY; | 293 first = NativeThrowBehavior.MAY; |
265 } | 294 } |
266 | 295 |
267 return sequence(first, second); | 296 return sequence(first, second); |
268 } | 297 } |
269 } | 298 } |
OLD | NEW |