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 '../closure.dart' show ClosureRepresentationInfo; | 7 import '../closure.dart' show ClosureRepresentationInfo; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/names.dart' show Identifiers, Selectors; | 9 import '../common/names.dart' show Identifiers, Selectors; |
10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 declarationMethod is ConstructorElement, | 954 declarationMethod is ConstructorElement, |
955 failedAt( | 955 failedAt( |
956 parameter, | 956 parameter, |
957 "Unexpected function declaration " | 957 "Unexpected function declaration " |
958 "${declarationMethod}, expected ${analyzedElement}.")); | 958 "${declarationMethod}, expected ${analyzedElement}.")); |
959 visitor = new ElementGraphBuilder(declarationMethod, | 959 visitor = new ElementGraphBuilder(declarationMethod, |
960 parameter.functionDeclaration.resolvedAst, compiler, inferrer); | 960 parameter.functionDeclaration.resolvedAst, compiler, inferrer); |
961 } | 961 } |
962 TypeInformation type = | 962 TypeInformation type = |
963 (defaultValue == null) ? types.nullType : visitor.visit(defaultValue); | 963 (defaultValue == null) ? types.nullType : visitor.visit(defaultValue); |
964 inferrer.setDefaultTypeOfParameter(parameter, type); | 964 inferrer.setDefaultTypeOfParameter(parameter, type, |
| 965 isInstanceMember: function.isInstanceMember); |
965 }); | 966 }); |
966 | 967 |
967 if (closedWorld.nativeData.isNativeMember(analyzedElement)) { | 968 if (closedWorld.nativeData.isNativeMember(analyzedElement)) { |
968 // Native methods do not have a body, and we currently just say | 969 // Native methods do not have a body, and we currently just say |
969 // they return dynamic. | 970 // they return dynamic. |
970 return types.dynamicType; | 971 return types.dynamicType; |
971 } | 972 } |
972 | 973 |
973 if (analyzedElement.isGenerativeConstructor) { | 974 if (analyzedElement.isGenerativeConstructor) { |
974 ConstructorElement analyzedConstructor = analyzedElement; | 975 ConstructorElement analyzedConstructor = analyzedElement; |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2951 Selector moveNextSelector = Selectors.moveNext; | 2952 Selector moveNextSelector = Selectors.moveNext; |
2952 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node); | 2953 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node); |
2953 | 2954 |
2954 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, | 2955 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, |
2955 iteratorMask, expressionType, new ArgumentsTypes.empty()); | 2956 iteratorMask, expressionType, new ArgumentsTypes.empty()); |
2956 | 2957 |
2957 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2958 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
2958 moveNextSelector, moveNextMask); | 2959 moveNextSelector, moveNextMask); |
2959 } | 2960 } |
2960 } | 2961 } |
OLD | NEW |