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.isConditional) { | 501 } else if (node.isOperator || 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 return new DynamicAccess.ifNotNullProperty(node.receiver); | 505 // TODO(johnniwinther): maybe add DynamicAccess.conditionalDynamicProperty |
506 } else if (node.isOperator) { | |
507 return new DynamicAccess.dynamicProperty(node.receiver); | 506 return new DynamicAccess.dynamicProperty(node.receiver); |
508 } else if (Elements.isClosureSend(node, element)) { | 507 } else if (Elements.isClosureSend(node, element)) { |
509 if (element == null) { | 508 if (element == null) { |
510 if (node.selector.isThis()) { | 509 if (node.selector.isThis()) { |
511 return new AccessSemantics.thisAccess(); | 510 return new AccessSemantics.thisAccess(); |
512 } else { | 511 } else { |
513 return new AccessSemantics.expression(); | 512 return new AccessSemantics.expression(); |
514 } | 513 } |
515 } else if (Elements.isErroneous(element)) { | 514 } else if (Elements.isErroneous(element)) { |
516 return new StaticAccess.unresolved(element); | 515 return new StaticAccess.unresolved(element); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 return internalError(node, "Unexpected variable $element."); | 982 return internalError(node, "Unexpected variable $element."); |
984 } | 983 } |
985 if (element.isConst) { | 984 if (element.isConst) { |
986 ConstantExpression constant = elements.getConstant(element.initializer); | 985 ConstantExpression constant = elements.getConstant(element.initializer); |
987 return new ConstantVariableStructure(kind, node, element, constant); | 986 return new ConstantVariableStructure(kind, node, element, constant); |
988 } else { | 987 } else { |
989 return new NonConstantVariableStructure(kind, node, element); | 988 return new NonConstantVariableStructure(kind, node, element); |
990 } | 989 } |
991 } | 990 } |
992 } | 991 } |
OLD | NEW |