| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (semantics == null) { | 227 if (semantics == null) { |
| 228 return internalError(node, 'No semantics for $node'); | 228 return internalError(node, 'No semantics for $node'); |
| 229 } | 229 } |
| 230 Selector selector = elements.getSelector(node); | 230 Selector selector = elements.getSelector(node); |
| 231 switch (kind) { | 231 switch (kind) { |
| 232 case SendStructureKind.GET: | 232 case SendStructureKind.GET: |
| 233 return new GetStructure(semantics, selector); | 233 return new GetStructure(semantics, selector); |
| 234 case SendStructureKind.SET: | 234 case SendStructureKind.SET: |
| 235 return new SetStructure(semantics, selector); | 235 return new SetStructure(semantics, selector); |
| 236 case SendStructureKind.INVOKE: | 236 case SendStructureKind.INVOKE: |
| 237 if (semantics.kind == AccessKind.SUPER_METHOD) { |
| 238 // TODO(johnniwinther): Find all statically resolved case that should |
| 239 // go here (top level, static, local, ...). |
| 240 if (!selector.callStructure.signatureApplies(semantics.element)) { |
| 241 return new IncompatibleInvokeStructure(semantics, selector); |
| 242 } |
| 243 } |
| 237 return new InvokeStructure(semantics, selector); | 244 return new InvokeStructure(semantics, selector); |
| 238 case SendStructureKind.UNARY: | 245 case SendStructureKind.UNARY: |
| 239 return new UnaryStructure(semantics, unaryOperator, selector); | 246 return new UnaryStructure(semantics, unaryOperator, selector); |
| 240 case SendStructureKind.NOT: | 247 case SendStructureKind.NOT: |
| 241 assert(selector == null); | 248 assert(selector == null); |
| 242 return new NotStructure(semantics, selector); | 249 return new NotStructure(semantics, selector); |
| 243 case SendStructureKind.BINARY: | 250 case SendStructureKind.BINARY: |
| 244 return new BinaryStructure(semantics, binaryOperator, selector); | 251 return new BinaryStructure(semantics, binaryOperator, selector); |
| 245 case SendStructureKind.INDEX: | 252 case SendStructureKind.INDEX: |
| 246 return new IndexStructure(semantics, selector); | 253 return new IndexStructure(semantics, selector); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 return new ConstantAccess.typedefTypeLiteral(constant); | 328 return new ConstantAccess.typedefTypeLiteral(constant); |
| 322 case TypeKind.TYPE_VARIABLE: | 329 case TypeKind.TYPE_VARIABLE: |
| 323 return new StaticAccess.typeParameterTypeLiteral(dartType.element); | 330 return new StaticAccess.typeParameterTypeLiteral(dartType.element); |
| 324 case TypeKind.DYNAMIC: | 331 case TypeKind.DYNAMIC: |
| 325 return new ConstantAccess.dynamicTypeLiteral(constant); | 332 return new ConstantAccess.dynamicTypeLiteral(constant); |
| 326 default: | 333 default: |
| 327 return internalError(node, "Unexpected type literal type: $dartType"); | 334 return internalError(node, "Unexpected type literal type: $dartType"); |
| 328 } | 335 } |
| 329 } else if (node.isSuperCall) { | 336 } else if (node.isSuperCall) { |
| 330 if (Elements.isUnresolved(element)) { | 337 if (Elements.isUnresolved(element)) { |
| 331 return new StaticAccess.unresolved(element); | 338 return new StaticAccess.unresolvedSuper(element); |
| 332 } else if (isCompound && Elements.isUnresolved(getter)) { | 339 } else if (isCompound && Elements.isUnresolved(getter)) { |
| 333 // TODO(johnniwinther): Ensure that [getter] is not null. This happens | 340 // TODO(johnniwinther): Ensure that [getter] is not null. This happens |
| 334 // in the case of missing super getter. | 341 // in the case of missing super getter. |
| 335 return new StaticAccess.unresolved(getter); | 342 return new StaticAccess.unresolved(getter); |
| 336 } else if (element.isField) { | 343 } else if (element.isField) { |
| 337 if (getter != null && getter != element) { | 344 if (getter != null && getter != element) { |
| 338 CompoundAccessKind accessKind; | 345 CompoundAccessKind accessKind; |
| 339 if (getter.isField) { | 346 if (getter.isField) { |
| 340 accessKind = CompoundAccessKind.SUPER_FIELD_FIELD; | 347 accessKind = CompoundAccessKind.SUPER_FIELD_FIELD; |
| 341 } else if (getter.isGetter) { | 348 } else if (getter.isGetter) { |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 return internalError(node, "Unexpected variable $element."); | 785 return internalError(node, "Unexpected variable $element."); |
| 779 } | 786 } |
| 780 if (element.isConst) { | 787 if (element.isConst) { |
| 781 ConstantExpression constant = elements.getConstant(element.initializer); | 788 ConstantExpression constant = elements.getConstant(element.initializer); |
| 782 return new ConstantVariableStructure(kind, node, element, constant); | 789 return new ConstantVariableStructure(kind, node, element, constant); |
| 783 } else { | 790 } else { |
| 784 return new NonConstantVariableStructure(kind, node, element); | 791 return new NonConstantVariableStructure(kind, node, element); |
| 785 } | 792 } |
| 786 } | 793 } |
| 787 } | 794 } |
| OLD | NEW |