| 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 import '../js/js.dart' as js; | 5 import '../js/js.dart' as js; |
| 6 import '../universe/side_effects.dart' show SideEffects; | 6 import '../universe/side_effects.dart' show SideEffects; |
| 7 import 'behavior.dart'; | 7 import 'behavior.dart'; |
| 8 | 8 |
| 9 class HasCapturedPlaceholders extends js.BaseVisitor { | 9 class HasCapturedPlaceholders extends js.BaseVisitor { |
| 10 HasCapturedPlaceholders._(); | 10 HasCapturedPlaceholders._(); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 sideEffects.setDependsOnStaticPropertyStore(); | 109 sideEffects.setDependsOnStaticPropertyStore(); |
| 110 node.visitChildren(this); | 110 node.visitChildren(this); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 /// ThrowBehaviorVisitor generates a NativeThrowBehavior describing the | 114 /// ThrowBehaviorVisitor generates a NativeThrowBehavior describing the |
| 115 /// exception behavior of a JavaScript expression. | 115 /// exception behavior of a JavaScript expression. |
| 116 /// | 116 /// |
| 117 /// The result is semi-conservative, giving reasonable results for many simple | 117 /// The result is semi-conservative, giving reasonable results for many simple |
| 118 /// JS fragments. The non-conservative part is the assumption that binary | 118 /// JS fragments. The non-conservative part is the assumption that binary |
| 119 /// operators are used on 'good' operands that do not force arbirary code to be | 119 /// operators are used on 'good' operands that do not force arbitrary code to be |
| 120 /// executed via conversions (valueOf() and toString() methods). | 120 /// executed via conversions (valueOf() and toString() methods). |
| 121 /// | 121 /// |
| 122 /// In many cases a JS fragment has more precise behavior. In these cases the | 122 /// In many cases a JS fragment has more precise behavior. In these cases the |
| 123 /// behavior should be described as a property of the JS fragment. For example, | 123 /// behavior should be described as a property of the JS fragment. For example, |
| 124 /// Object.keys(#) has a TypeError on null / undefined, which can only be known | 124 /// Object.keys(#) has a TypeError on null / undefined, which can only be known |
| 125 /// in the calling context. | 125 /// in the calling context. |
| 126 /// | 126 /// |
| 127 class ThrowBehaviorVisitor extends js.BaseVisitor<NativeThrowBehavior> { | 127 class ThrowBehaviorVisitor extends js.BaseVisitor<NativeThrowBehavior> { |
| 128 ThrowBehaviorVisitor(); | 128 ThrowBehaviorVisitor(); |
| 129 | 129 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 receiver.isPositional && | 287 receiver.isPositional && |
| 288 receiver.nameOrPosition == 0) { | 288 receiver.nameOrPosition == 0) { |
| 289 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; | 289 first = NativeThrowBehavior.MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; |
| 290 } else { | 290 } else { |
| 291 first = NativeThrowBehavior.MAY; | 291 first = NativeThrowBehavior.MAY; |
| 292 } | 292 } |
| 293 | 293 |
| 294 return sequence(first, second); | 294 return sequence(first, second); |
| 295 } | 295 } |
| 296 } | 296 } |
| OLD | NEW |