| 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 // TODO(johnniwinther): Temporarily copied from analyzer2dart. Merge when | 5 // TODO(johnniwinther): Temporarily copied from analyzer2dart. Merge when |
| 6 // we shared code with the analyzer and this semantic visitor is complete. | 6 // we shared code with the analyzer and this semantic visitor is complete. |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Code for classifying the semantics of identifiers appearing in a Dart file. | 9 * Code for classifying the semantics of identifiers appearing in a Dart file. |
| 10 */ | 10 */ |
| 11 library dart2js.access_semantics; | 11 library dart2js.access_semantics; |
| 12 | 12 |
| 13 import '../constants/expressions.dart'; | 13 import '../constants/expressions.dart'; |
| 14 import '../elements/elements.dart'; | 14 import '../elements/elements.dart'; |
| 15 import '../dart_types.dart'; | 15 import '../dart_types.dart'; |
| 16 | 16 |
| 17 /// Enum representing the different kinds of destinations which a property | 17 /// Enum representing the different kinds of destinations which a property |
| 18 /// access or method or function invocation might refer to. | 18 /// access or method or function invocation might refer to. |
| 19 enum AccessKind { | 19 enum AccessKind { |
| 20 /// The destination of the conditional access is an instance method, property, |
| 21 /// or field of a class, and thus must be determined dynamically. |
| 22 CONDITIONAL_DYNAMIC_PROPERTY, |
| 23 |
| 20 /// The destination of the access is an instance method, property, or field | 24 /// The destination of the access is an instance method, property, or field |
| 21 /// of a class, and thus must be determined dynamically. | 25 /// of a class, and thus must be determined dynamically. |
| 22 DYNAMIC_PROPERTY, | 26 DYNAMIC_PROPERTY, |
| 23 | 27 |
| 24 // TODO(johnniwinther): Split these cases into captured and non-captured | 28 // TODO(johnniwinther): Split these cases into captured and non-captured |
| 25 // local access. | 29 // local access. |
| 26 /// The destination of the access is a function that is defined locally within | 30 /// The destination of the access is a function that is defined locally within |
| 27 /// an enclosing function or method. | 31 /// an enclosing function or method. |
| 28 LOCAL_FUNCTION, | 32 LOCAL_FUNCTION, |
| 29 | 33 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 return sb.toString(); | 253 return sb.toString(); |
| 250 } | 254 } |
| 251 } | 255 } |
| 252 | 256 |
| 253 | 257 |
| 254 class DynamicAccess extends AccessSemantics { | 258 class DynamicAccess extends AccessSemantics { |
| 255 final target; | 259 final target; |
| 256 | 260 |
| 257 DynamicAccess.dynamicProperty(this.target) | 261 DynamicAccess.dynamicProperty(this.target) |
| 258 : super._(AccessKind.DYNAMIC_PROPERTY); | 262 : super._(AccessKind.DYNAMIC_PROPERTY); |
| 263 |
| 264 DynamicAccess.ifNotNullProperty(this.target) |
| 265 : super._(AccessKind.CONDITIONAL_DYNAMIC_PROPERTY); |
| 259 } | 266 } |
| 260 | 267 |
| 261 class ConstantAccess extends AccessSemantics { | 268 class ConstantAccess extends AccessSemantics { |
| 262 final ConstantExpression constant; | 269 final ConstantExpression constant; |
| 263 | 270 |
| 264 ConstantAccess(AccessKind kind, this.constant) | 271 ConstantAccess(AccessKind kind, this.constant) |
| 265 : super._(kind); | 272 : super._(kind); |
| 266 | 273 |
| 267 ConstantAccess.classTypeLiteral(this.constant) | 274 ConstantAccess.classTypeLiteral(this.constant) |
| 268 : super._(AccessKind.CLASS_TYPE_LITERAL); | 275 : super._(AccessKind.CLASS_TYPE_LITERAL); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 | 532 |
| 526 RedirectingFactoryConstructorAccessSemantics( | 533 RedirectingFactoryConstructorAccessSemantics( |
| 527 ConstructorAccessKind kind, | 534 ConstructorAccessKind kind, |
| 528 Element element, | 535 Element element, |
| 529 DartType type, | 536 DartType type, |
| 530 this.effectiveTargetSemantics) | 537 this.effectiveTargetSemantics) |
| 531 : super(kind, element, type); | 538 : super(kind, element, type); |
| 532 } | 539 } |
| 533 | 540 |
| 534 | 541 |
| OLD | NEW |