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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 case SendStructureKind.GET: | 326 case SendStructureKind.GET: |
327 return new GetStructure(semantics, selector); | 327 return new GetStructure(semantics, selector); |
328 case SendStructureKind.SET: | 328 case SendStructureKind.SET: |
329 return new SetStructure(semantics, selector); | 329 return new SetStructure(semantics, selector); |
330 case SendStructureKind.INVOKE: | 330 case SendStructureKind.INVOKE: |
331 switch (semantics.kind) { | 331 switch (semantics.kind) { |
332 case AccessKind.STATIC_METHOD: | 332 case AccessKind.STATIC_METHOD: |
333 case AccessKind.SUPER_METHOD: | 333 case AccessKind.SUPER_METHOD: |
334 case AccessKind.TOPLEVEL_METHOD: | 334 case AccessKind.TOPLEVEL_METHOD: |
335 // TODO(johnniwinther): Should local function also be handled here? | 335 // TODO(johnniwinther): Should local function also be handled here? |
336 if (!selector.callStructure.signatureApplies(semantics.element)) { | 336 FunctionElement function = semantics.element; |
| 337 FunctionSignature signature = function.functionSignature; |
| 338 if (!selector.callStructure.signatureApplies(signature)) { |
337 return new IncompatibleInvokeStructure(semantics, selector); | 339 return new IncompatibleInvokeStructure(semantics, selector); |
338 } | 340 } |
339 break; | 341 break; |
340 default: | 342 default: |
341 break; | 343 break; |
342 } | 344 } |
343 return new InvokeStructure(semantics, selector); | 345 return new InvokeStructure(semantics, selector); |
344 case SendStructureKind.UNARY: | 346 case SendStructureKind.UNARY: |
345 return internalError(node, "Unexpected unary."); | 347 return internalError(node, "Unexpected unary."); |
346 case SendStructureKind.NOT: | 348 case SendStructureKind.NOT: |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 constructor, | 581 constructor, |
580 type, | 582 type, |
581 effectiveTargetSemantics); | 583 effectiveTargetSemantics); |
582 } | 584 } |
583 return new RedirectingFactoryConstructorAccessSemantics( | 585 return new RedirectingFactoryConstructorAccessSemantics( |
584 ConstructorAccessKind.REDIRECTING_FACTORY, | 586 ConstructorAccessKind.REDIRECTING_FACTORY, |
585 constructor, | 587 constructor, |
586 type, | 588 type, |
587 effectiveTargetSemantics); | 589 effectiveTargetSemantics); |
588 } else { | 590 } else { |
589 if (!callStructure.signatureApplies(constructor)) { | 591 if (!callStructure.signatureApplies(constructor.functionSignature)) { |
590 return new ConstructorAccessSemantics( | 592 return new ConstructorAccessSemantics( |
591 ConstructorAccessKind.INCOMPATIBLE, | 593 ConstructorAccessKind.INCOMPATIBLE, |
592 constructor, | 594 constructor, |
593 type); | 595 type); |
594 } else if (constructor.isFactoryConstructor) { | 596 } else if (constructor.isFactoryConstructor) { |
595 return new ConstructorAccessSemantics( | 597 return new ConstructorAccessSemantics( |
596 ConstructorAccessKind.FACTORY, constructor, type); | 598 ConstructorAccessKind.FACTORY, constructor, type); |
597 } else if (constructor.isRedirectingGenerative) { | 599 } else if (constructor.isRedirectingGenerative) { |
598 if (constructor.enclosingClass.isAbstract) { | 600 if (constructor.enclosingClass.isAbstract) { |
599 return new ConstructorAccessSemantics( | 601 return new ConstructorAccessSemantics( |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 return internalError(node, "Unexpected variable $element."); | 985 return internalError(node, "Unexpected variable $element."); |
984 } | 986 } |
985 if (element.isConst) { | 987 if (element.isConst) { |
986 ConstantExpression constant = elements.getConstant(element.initializer); | 988 ConstantExpression constant = elements.getConstant(element.initializer); |
987 return new ConstantVariableStructure(kind, node, element, constant); | 989 return new ConstantVariableStructure(kind, node, element, constant); |
988 } else { | 990 } else { |
989 return new NonConstantVariableStructure(kind, node, element); | 991 return new NonConstantVariableStructure(kind, node, element); |
990 } | 992 } |
991 } | 993 } |
992 } | 994 } |
OLD | NEW |