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 part of dart2js.semantics_visitor; | 5 part of dart2js.semantics_visitor; |
6 | 6 |
7 enum SendStructureKind { | 7 enum SendStructureKind { |
8 GET, | 8 GET, |
9 SET, | 9 SET, |
10 INVOKE, | 10 INVOKE, |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 return new CompoundAccessSemantics(accessKind, getter, element); | 492 return new CompoundAccessSemantics(accessKind, getter, element); |
493 } | 493 } |
494 return new StaticAccess.superSetter(element); | 494 return new StaticAccess.superSetter(element); |
495 } else if (isCompound) { | 495 } else if (isCompound) { |
496 return new CompoundAccessSemantics( | 496 return new CompoundAccessSemantics( |
497 CompoundAccessKind.SUPER_GETTER_SETTER, getter, element); | 497 CompoundAccessKind.SUPER_GETTER_SETTER, getter, element); |
498 } else { | 498 } else { |
499 return new StaticAccess.superMethod(element); | 499 return new StaticAccess.superMethod(element); |
500 } | 500 } |
501 } else if (node.isOperator || node.isConditional) { | 501 } else if (node.isConditional) { |
502 // Conditional sends (e?.x) are treated as dynamic property reads because | 502 // Conditional sends (e?.x) are treated as dynamic property reads because |
503 // they are equivalent to do ((a) => a == null ? null : a.x)(e). If `e` is | 503 // they are equivalent to do ((a) => a == null ? null : a.x)(e). If `e` is |
504 // a type `A`, this is equivalent to write `(A).x`. | 504 // a type `A`, this is equivalent to write `(A).x`. |
505 // TODO(johnniwinther): maybe add DynamicAccess.conditionalDynamicProperty | 505 return new DynamicAccess.ifNotNullProperty(node.receiver); |
| 506 } else if (node.isOperator) { |
506 return new DynamicAccess.dynamicProperty(node.receiver); | 507 return new DynamicAccess.dynamicProperty(node.receiver); |
507 } else if (Elements.isClosureSend(node, element)) { | 508 } else if (Elements.isClosureSend(node, element)) { |
508 if (element == null) { | 509 if (element == null) { |
509 if (node.selector.isThis()) { | 510 if (node.selector.isThis()) { |
510 return new AccessSemantics.thisAccess(); | 511 return new AccessSemantics.thisAccess(); |
511 } else { | 512 } else { |
512 return new AccessSemantics.expression(); | 513 return new AccessSemantics.expression(); |
513 } | 514 } |
514 } else if (Elements.isErroneous(element)) { | 515 } else if (Elements.isErroneous(element)) { |
515 return new StaticAccess.unresolved(element); | 516 return new StaticAccess.unresolved(element); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 return internalError(node, "Unexpected variable $element."); | 983 return internalError(node, "Unexpected variable $element."); |
983 } | 984 } |
984 if (element.isConst) { | 985 if (element.isConst) { |
985 ConstantExpression constant = elements.getConstant(element.initializer); | 986 ConstantExpression constant = elements.getConstant(element.initializer); |
986 return new ConstantVariableStructure(kind, node, element, constant); | 987 return new ConstantVariableStructure(kind, node, element, constant); |
987 } else { | 988 } else { |
988 return new NonConstantVariableStructure(kind, node, element); | 989 return new NonConstantVariableStructure(kind, node, element); |
989 } | 990 } |
990 } | 991 } |
991 } | 992 } |
OLD | NEW |