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 ClosureClassMap; | 7 import '../closure.dart' show ClosureClassMap; |
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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 bool get inInstanceContext { | 1205 bool get inInstanceContext { |
1206 return (outermostElement.isInstanceMember && !outermostElement.isField) || | 1206 return (outermostElement.isInstanceMember && !outermostElement.isField) || |
1207 outermostElement.isGenerativeConstructor; | 1207 outermostElement.isGenerativeConstructor; |
1208 } | 1208 } |
1209 | 1209 |
1210 bool treatAsInstanceMember(Element element) { | 1210 bool treatAsInstanceMember(Element element) { |
1211 return (Elements.isUnresolved(element) && inInstanceContext) || | 1211 return (Elements.isUnresolved(element) && inInstanceContext) || |
1212 (element != null && element.isInstanceMember); | 1212 (element != null && element.isInstanceMember); |
1213 } | 1213 } |
1214 | 1214 |
1215 @override | |
1216 TypeInformation handleSendSet(ast.SendSet node) { | 1215 TypeInformation handleSendSet(ast.SendSet node) { |
1217 Element element = elements[node]; | 1216 Element element = elements[node]; |
1218 if (!Elements.isUnresolved(element) && element.impliesType) { | 1217 if (!Elements.isUnresolved(element) && element.impliesType) { |
1219 node.visitChildren(this); | 1218 node.visitChildren(this); |
1220 return types.dynamicType; | 1219 return types.dynamicType; |
1221 } | 1220 } |
1222 | 1221 |
1223 Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node); | 1222 Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node); |
1224 TypeMask getterMask = inTreeData.typeOfGetter(node); | 1223 TypeMask getterMask = inTreeData.typeOfGetter(node); |
1225 TypeMask operatorMask = inTreeData.typeOfOperator(node); | 1224 TypeMask operatorMask = inTreeData.typeOfOperator(node); |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 } | 2269 } |
2271 } | 2270 } |
2272 return null; | 2271 return null; |
2273 } | 2272 } |
2274 | 2273 |
2275 TypeInformation visitAwait(ast.Await node) { | 2274 TypeInformation visitAwait(ast.Await node) { |
2276 TypeInformation futureType = node.expression.accept(this); | 2275 TypeInformation futureType = node.expression.accept(this); |
2277 return inferrer.registerAwait(node, futureType); | 2276 return inferrer.registerAwait(node, futureType); |
2278 } | 2277 } |
2279 | 2278 |
2280 @override | |
2281 TypeInformation handleTypeLiteralInvoke(ast.NodeList arguments) { | 2279 TypeInformation handleTypeLiteralInvoke(ast.NodeList arguments) { |
2282 // This is reached when users forget to put a `new` in front of a type | 2280 // This is reached when users forget to put a `new` in front of a type |
2283 // literal. The emitter will generate an actual call (even though it is | 2281 // literal. The emitter will generate an actual call (even though it is |
2284 // likely invalid), and for that it needs to have the arguments processed | 2282 // likely invalid), and for that it needs to have the arguments processed |
2285 // as well. | 2283 // as well. |
2286 analyzeArguments(arguments.nodes); | 2284 analyzeArguments(arguments.nodes); |
2287 return types.dynamicType; | 2285 return types.dynamicType; |
2288 } | 2286 } |
2289 | 2287 |
2290 /// Handle constructor invocation of [constructor]. | 2288 /// Handle constructor invocation of [constructor]. |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2930 Selector moveNextSelector = Selectors.moveNext; | 2928 Selector moveNextSelector = Selectors.moveNext; |
2931 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); | 2929 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); |
2932 | 2930 |
2933 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, | 2931 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, |
2934 iteratorMask, expressionType, new ArgumentsTypes.empty()); | 2932 iteratorMask, expressionType, new ArgumentsTypes.empty()); |
2935 | 2933 |
2936 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2934 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
2937 moveNextSelector, moveNextMask); | 2935 moveNextSelector, moveNextMask); |
2938 } | 2936 } |
2939 } | 2937 } |
OLD | NEW |