| 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 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 return handleSuperNoSuchMethod(node, selector, mask, arguments); | 2038 return handleSuperNoSuchMethod(node, selector, mask, arguments); |
| 2039 } | 2039 } |
| 2040 | 2040 |
| 2041 TypeInformation handleSuperNoSuchMethod(ast.Send node, Selector selector, | 2041 TypeInformation handleSuperNoSuchMethod(ast.Send node, Selector selector, |
| 2042 TypeMask mask, ArgumentsTypes arguments) { | 2042 TypeMask mask, ArgumentsTypes arguments) { |
| 2043 // Ensure we create a node, to make explicit the call to the | 2043 // Ensure we create a node, to make explicit the call to the |
| 2044 // `noSuchMethod` handler. | 2044 // `noSuchMethod` handler. |
| 2045 ClassElement cls = outermostElement.enclosingClass; | 2045 ClassElement cls = outermostElement.enclosingClass; |
| 2046 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); | 2046 MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_); |
| 2047 if (!Selectors.noSuchMethod_.signatureApplies(element)) { | 2047 if (!Selectors.noSuchMethod_.signatureApplies(element)) { |
| 2048 ClassElement objectClass = compiler.commonElements.objectClass; | 2048 ClassElement objectClass = closedWorld.commonElements.objectClass; |
| 2049 element = objectClass.lookupMember(Identifiers.noSuchMethod_); | 2049 element = objectClass.lookupMember(Identifiers.noSuchMethod_); |
| 2050 } | 2050 } |
| 2051 return handleStaticSend(node, selector, mask, element, arguments); | 2051 return handleStaticSend(node, selector, mask, element, arguments); |
| 2052 } | 2052 } |
| 2053 | 2053 |
| 2054 /// Handle a .call invocation on the values retrieved from the super | 2054 /// Handle a .call invocation on the values retrieved from the super |
| 2055 /// [element]. For instance `super.foo(bar)` where `foo` is a field or getter. | 2055 /// [element]. For instance `super.foo(bar)` where `foo` is a field or getter. |
| 2056 TypeInformation handleSuperClosureCall( | 2056 TypeInformation handleSuperClosureCall( |
| 2057 ast.Send node, Element element, ast.NodeList arguments) { | 2057 ast.Send node, Element element, ast.NodeList arguments) { |
| 2058 ArgumentsTypes argumentTypes = analyzeArguments(arguments.nodes); | 2058 ArgumentsTypes argumentTypes = analyzeArguments(arguments.nodes); |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2923 } | 2923 } |
| 2924 | 2924 |
| 2925 TypeInformation visitAsyncForIn(ast.AsyncForIn node) { | 2925 TypeInformation visitAsyncForIn(ast.AsyncForIn node) { |
| 2926 TypeInformation expressionType = visit(node.expression); | 2926 TypeInformation expressionType = visit(node.expression); |
| 2927 | 2927 |
| 2928 Selector currentSelector = Selectors.current; | 2928 Selector currentSelector = Selectors.current; |
| 2929 TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node); | 2929 TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node); |
| 2930 Selector moveNextSelector = Selectors.moveNext; | 2930 Selector moveNextSelector = Selectors.moveNext; |
| 2931 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); | 2931 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); |
| 2932 | 2932 |
| 2933 ConstructorElement ctor = compiler.commonElements.streamIteratorConstructor; | 2933 ConstructorElement ctor = |
| 2934 closedWorld.commonElements.streamIteratorConstructor; |
| 2934 | 2935 |
| 2935 /// Synthesize a call to the [StreamIterator] constructor. | 2936 /// Synthesize a call to the [StreamIterator] constructor. |
| 2936 TypeInformation iteratorType = handleStaticSend( | 2937 TypeInformation iteratorType = handleStaticSend( |
| 2937 node, null, null, ctor, new ArgumentsTypes([expressionType], null)); | 2938 node, null, null, ctor, new ArgumentsTypes([expressionType], null)); |
| 2938 | 2939 |
| 2939 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2940 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
| 2940 moveNextSelector, moveNextMask); | 2941 moveNextSelector, moveNextMask); |
| 2941 } | 2942 } |
| 2942 | 2943 |
| 2943 TypeInformation visitSyncForIn(ast.SyncForIn node) { | 2944 TypeInformation visitSyncForIn(ast.SyncForIn node) { |
| 2944 TypeInformation expressionType = visit(node.expression); | 2945 TypeInformation expressionType = visit(node.expression); |
| 2945 Selector iteratorSelector = Selectors.iterator; | 2946 Selector iteratorSelector = Selectors.iterator; |
| 2946 TypeMask iteratorMask = inTreeData.typeOfIterator(node); | 2947 TypeMask iteratorMask = inTreeData.typeOfIterator(node); |
| 2947 Selector currentSelector = Selectors.current; | 2948 Selector currentSelector = Selectors.current; |
| 2948 TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node); | 2949 TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node); |
| 2949 Selector moveNextSelector = Selectors.moveNext; | 2950 Selector moveNextSelector = Selectors.moveNext; |
| 2950 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); | 2951 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); |
| 2951 | 2952 |
| 2952 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, | 2953 TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector, |
| 2953 iteratorMask, expressionType, new ArgumentsTypes.empty()); | 2954 iteratorMask, expressionType, new ArgumentsTypes.empty()); |
| 2954 | 2955 |
| 2955 return handleForInLoop(node, iteratorType, currentSelector, currentMask, | 2956 return handleForInLoop(node, iteratorType, currentSelector, currentMask, |
| 2956 moveNextSelector, moveNextMask); | 2957 moveNextSelector, moveNextMask); |
| 2957 } | 2958 } |
| 2958 } | 2959 } |
| OLD | NEW |