| 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) { | 237 switch (semantics.kind) { |
| 238 // TODO(johnniwinther): Find all statically resolved case that should | 238 case AccessKind.STATIC_METHOD: |
| 239 // go here (top level, static, local, ...). | 239 case AccessKind.SUPER_METHOD: |
| 240 if (!selector.callStructure.signatureApplies(semantics.element)) { | 240 case AccessKind.TOPLEVEL_METHOD: |
| 241 return new IncompatibleInvokeStructure(semantics, selector); | 241 // TODO(johnniwinther): Should local function also be handled here? |
| 242 } | 242 if (!selector.callStructure.signatureApplies(semantics.element)) { |
| 243 return new IncompatibleInvokeStructure(semantics, selector); |
| 244 } |
| 245 break; |
| 246 default: |
| 247 break; |
| 243 } | 248 } |
| 244 return new InvokeStructure(semantics, selector); | 249 return new InvokeStructure(semantics, selector); |
| 245 case SendStructureKind.UNARY: | 250 case SendStructureKind.UNARY: |
| 246 return new UnaryStructure(semantics, unaryOperator, selector); | 251 return new UnaryStructure(semantics, unaryOperator, selector); |
| 247 case SendStructureKind.NOT: | 252 case SendStructureKind.NOT: |
| 248 assert(selector == null); | 253 assert(selector == null); |
| 249 return new NotStructure(semantics, selector); | 254 return new NotStructure(semantics, selector); |
| 250 case SendStructureKind.BINARY: | 255 case SendStructureKind.BINARY: |
| 251 return new BinaryStructure(semantics, binaryOperator, selector); | 256 return new BinaryStructure(semantics, binaryOperator, selector); |
| 252 case SendStructureKind.INDEX: | 257 case SendStructureKind.INDEX: |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 return internalError(node, "Unexpected variable $element."); | 790 return internalError(node, "Unexpected variable $element."); |
| 786 } | 791 } |
| 787 if (element.isConst) { | 792 if (element.isConst) { |
| 788 ConstantExpression constant = elements.getConstant(element.initializer); | 793 ConstantExpression constant = elements.getConstant(element.initializer); |
| 789 return new ConstantVariableStructure(kind, node, element, constant); | 794 return new ConstantVariableStructure(kind, node, element, constant); |
| 790 } else { | 795 } else { |
| 791 return new NonConstantVariableStructure(kind, node, element); | 796 return new NonConstantVariableStructure(kind, node, element); |
| 792 } | 797 } |
| 793 } | 798 } |
| 794 } | 799 } |
| OLD | NEW |