OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library simple_types_inferrer; | 5 library simple_types_inferrer; |
6 | 6 |
7 import 'dart:collection' show Queue, LinkedHashSet; | 7 import 'dart:collection' show Queue, LinkedHashSet; |
8 | 8 |
9 import '../closure.dart' show ClosureClassMap, ClosureScope; | 9 import '../closure.dart' show ClosureClassMap, ClosureScope; |
10 import '../dart_types.dart' | 10 import '../dart_types.dart' |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } else { | 784 } else { |
785 assert(element.isGetter()); | 785 assert(element.isGetter()); |
786 return returnTypeOfElement(element); | 786 return returnTypeOfElement(element); |
787 } | 787 } |
788 } else if (selector.isIndex() | 788 } else if (selector.isIndex() |
789 && selector.mask != null | 789 && selector.mask != null |
790 && selector.mask.isContainer) { | 790 && selector.mask.isContainer) { |
791 ContainerTypeMask mask = selector.mask; | 791 ContainerTypeMask mask = selector.mask; |
792 TypeMask elementType = mask.elementType; | 792 TypeMask elementType = mask.elementType; |
793 return elementType == null ? dynamicType : elementType; | 793 return elementType == null ? dynamicType : elementType; |
| 794 } else if (element.isGetter()) { |
| 795 // Closure call. |
| 796 assert(selector.isCall()); |
| 797 return dynamicType; |
794 } else { | 798 } else { |
795 return returnTypeOfElement(element); | 799 return returnTypeOfElement(element); |
796 } | 800 } |
797 } | 801 } |
798 | 802 |
799 bool isNotClosure(Element element) { | 803 bool isNotClosure(Element element) { |
800 // If the outermost enclosing element of [element] is [element] | 804 // If the outermost enclosing element of [element] is [element] |
801 // itself, we know it cannot be a closure. | 805 // itself, we know it cannot be a closure. |
802 Element outermost = element.getOutermostEnclosingMemberOrTopLevel(); | 806 Element outermost = element.getOutermostEnclosingMemberOrTopLevel(); |
803 return outermost.declaration == element.declaration; | 807 return outermost.declaration == element.declaration; |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 } | 1940 } |
1937 | 1941 |
1938 handlePlainAssignment(identifier, element, selector, | 1942 handlePlainAssignment(identifier, element, selector, |
1939 receiverType, currentType, | 1943 receiverType, currentType, |
1940 node.expression); | 1944 node.expression); |
1941 return handleLoop(node, () { | 1945 return handleLoop(node, () { |
1942 visit(node.body); | 1946 visit(node.body); |
1943 }); | 1947 }); |
1944 } | 1948 } |
1945 } | 1949 } |
OLD | NEW |