| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 SetIfNullBulkMixin<TypeInformation, dynamic>, | 51 SetIfNullBulkMixin<TypeInformation, dynamic>, |
| 52 PrefixBulkMixin<TypeInformation, dynamic>, | 52 PrefixBulkMixin<TypeInformation, dynamic>, |
| 53 PostfixBulkMixin<TypeInformation, dynamic>, | 53 PostfixBulkMixin<TypeInformation, dynamic>, |
| 54 ErrorBulkMixin<TypeInformation, dynamic>, | 54 ErrorBulkMixin<TypeInformation, dynamic>, |
| 55 NewBulkMixin<TypeInformation, dynamic>, | 55 NewBulkMixin<TypeInformation, dynamic>, |
| 56 SetBulkMixin<TypeInformation, dynamic> | 56 SetBulkMixin<TypeInformation, dynamic> |
| 57 implements SemanticSendVisitor<TypeInformation, dynamic> { | 57 implements SemanticSendVisitor<TypeInformation, dynamic> { |
| 58 final Compiler compiler; | 58 final Compiler compiler; |
| 59 final MemberElement analyzedElement; | 59 final MemberElement analyzedElement; |
| 60 final ResolvedAst resolvedAst; | 60 final ResolvedAst resolvedAst; |
| 61 final TypeSystem types; | 61 final TypeSystem<ast.Node> types; |
| 62 final Map<JumpTarget, List<LocalsHandler>> breaksFor = | 62 final Map<JumpTarget, List<LocalsHandler>> breaksFor = |
| 63 new Map<JumpTarget, List<LocalsHandler>>(); | 63 new Map<JumpTarget, List<LocalsHandler>>(); |
| 64 final Map<JumpTarget, List<LocalsHandler>> continuesFor = | 64 final Map<JumpTarget, List<LocalsHandler>> continuesFor = |
| 65 new Map<JumpTarget, List<LocalsHandler>>(); | 65 new Map<JumpTarget, List<LocalsHandler>>(); |
| 66 LocalsHandler locals; | 66 LocalsHandler locals; |
| 67 final List<TypeInformation> cascadeReceiverStack = | 67 final List<TypeInformation> cascadeReceiverStack = |
| 68 new List<TypeInformation>(); | 68 new List<TypeInformation>(); |
| 69 | 69 |
| 70 TypeInformation returnType; | 70 TypeInformation returnType; |
| 71 bool visitingInitializers = false; | 71 bool visitingInitializers = false; |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 | 1158 |
| 1159 TypeInformation visitLiteralList(ast.LiteralList node) { | 1159 TypeInformation visitLiteralList(ast.LiteralList node) { |
| 1160 // We only set the type once. We don'TypeInformation need to re-visit the ch
ildren | 1160 // We only set the type once. We don'TypeInformation need to re-visit the ch
ildren |
| 1161 // when re-analyzing the node. | 1161 // when re-analyzing the node. |
| 1162 return inferrer.concreteTypes.putIfAbsent(node, () { | 1162 return inferrer.concreteTypes.putIfAbsent(node, () { |
| 1163 TypeInformation elementType; | 1163 TypeInformation elementType; |
| 1164 int length = 0; | 1164 int length = 0; |
| 1165 for (ast.Node element in node.elements.nodes) { | 1165 for (ast.Node element in node.elements.nodes) { |
| 1166 TypeInformation type = visit(element); | 1166 TypeInformation type = visit(element); |
| 1167 elementType = elementType == null | 1167 elementType = elementType == null |
| 1168 ? types.allocatePhi(null, null, type) | 1168 ? types.allocatePhi(null, null, type, isTry: false) |
| 1169 : types.addPhiInput(null, elementType, type); | 1169 : types.addPhiInput(null, elementType, type); |
| 1170 length++; | 1170 length++; |
| 1171 } | 1171 } |
| 1172 elementType = elementType == null | 1172 elementType = elementType == null |
| 1173 ? types.nonNullEmpty() | 1173 ? types.nonNullEmpty() |
| 1174 : types.simplifyPhi(null, null, elementType); | 1174 : types.simplifyPhi(null, null, elementType); |
| 1175 TypeInformation containerType = | 1175 TypeInformation containerType = |
| 1176 node.isConst ? types.constListType : types.growableListType; | 1176 node.isConst ? types.constListType : types.growableListType; |
| 1177 return types.allocateList( | 1177 return types.allocateList( |
| 1178 containerType, node, outermostElement, elementType, length); | 1178 containerType, node, outermostElement, elementType, length); |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2947 Selector moveNextSelector = Selectors.moveNext; | 2947 Selector moveNextSelector = Selectors.moveNext; |
| 2948 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node); | 2948 TypeMask moveNextMask = memberData.typeOfIteratorMoveNext(node); |
| 2949 | 2949 |
| 2950 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, | 2950 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, |
| 2951 iteratorMask, expressionType, new ArgumentsTypes.empty()); | 2951 iteratorMask, expressionType, new ArgumentsTypes.empty()); |
| 2952 | 2952 |
| 2953 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2953 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
| 2954 moveNextSelector, moveNextMask); | 2954 moveNextSelector, moveNextMask); |
| 2955 } | 2955 } |
| 2956 } | 2956 } |
| OLD | NEW |