Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Side by Side Diff: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart

Issue 2569733002: Even less reliance on Compiler.closedWorld (Closed)
Patch Set: Updated cf. comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 TypeMask mask = inTreeData.typeOfSend(node); 1688 TypeMask mask = inTreeData.typeOfSend(node);
1689 // In erroneous code the number of arguments in the selector might not 1689 // In erroneous code the number of arguments in the selector might not
1690 // match the function element. 1690 // match the function element.
1691 // TODO(polux): return nonNullEmpty and check it doesn't break anything 1691 // TODO(polux): return nonNullEmpty and check it doesn't break anything
1692 if (target.isMalformed || 1692 if (target.isMalformed ||
1693 !callStructure.signatureApplies(target.functionSignature)) { 1693 !callStructure.signatureApplies(target.functionSignature)) {
1694 return types.dynamicType; 1694 return types.dynamicType;
1695 } 1695 }
1696 1696
1697 T returnType = handleStaticSend(node, selector, mask, target, arguments); 1697 T returnType = handleStaticSend(node, selector, mask, target, arguments);
1698 if (Elements.isGrowableListConstructorCall(constructor, node, compiler)) { 1698 if (Elements.isGrowableListConstructorCall(
1699 constructor, node, closedWorld.commonElements)) {
1699 return inferrer.concreteTypes.putIfAbsent( 1700 return inferrer.concreteTypes.putIfAbsent(
1700 node, 1701 node,
1701 () => types.allocateList(types.growableListType, node, 1702 () => types.allocateList(types.growableListType, node,
1702 outermostElement, types.nonNullEmpty(), 0)); 1703 outermostElement, types.nonNullEmpty(), 0));
1703 } else if (Elements.isFixedListConstructorCall( 1704 } else if (Elements.isFixedListConstructorCall(
1704 constructor, node, compiler) || 1705 constructor, node, closedWorld.commonElements) ||
1705 Elements.isFilledListConstructorCall(constructor, node, compiler)) { 1706 Elements.isFilledListConstructorCall(
1707 constructor, node, closedWorld.commonElements)) {
1706 int length = findLength(node); 1708 int length = findLength(node);
1707 T elementType = 1709 T elementType = Elements.isFixedListConstructorCall(
1708 Elements.isFixedListConstructorCall(constructor, node, compiler) 1710 constructor, node, closedWorld.commonElements)
1709 ? types.nullType 1711 ? types.nullType
1710 : arguments.positional[1]; 1712 : arguments.positional[1];
1711 1713
1712 return inferrer.concreteTypes.putIfAbsent( 1714 return inferrer.concreteTypes.putIfAbsent(
1713 node, 1715 node,
1714 () => types.allocateList(types.fixedListType, node, outermostElement, 1716 () => types.allocateList(types.fixedListType, node, outermostElement,
1715 elementType, length)); 1717 elementType, length));
1716 } else if (Elements.isConstructorOfTypedArraySubclass( 1718 } else if (Elements.isConstructorOfTypedArraySubclass(
1717 constructor, compiler)) { 1719 constructor, closedWorld)) {
1718 int length = findLength(node); 1720 int length = findLength(node);
1719 T elementType = inferrer 1721 T elementType = inferrer
1720 .returnTypeOfElement(target.enclosingClass.lookupMember('[]')); 1722 .returnTypeOfElement(target.enclosingClass.lookupMember('[]'));
1721 return inferrer.concreteTypes.putIfAbsent( 1723 return inferrer.concreteTypes.putIfAbsent(
1722 node, 1724 node,
1723 () => types.allocateList(types.nonNullExact(target.enclosingClass), 1725 () => types.allocateList(types.nonNullExact(target.enclosingClass),
1724 node, outermostElement, elementType, length)); 1726 node, outermostElement, elementType, length));
1725 } else { 1727 } else {
1726 return returnType; 1728 return returnType;
1727 } 1729 }
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 Selector moveNextSelector = Selectors.moveNext; 2251 Selector moveNextSelector = Selectors.moveNext;
2250 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node); 2252 TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node);
2251 2253
2252 T iteratorType = handleDynamicSend(node, iteratorSelector, iteratorMask, 2254 T iteratorType = handleDynamicSend(node, iteratorSelector, iteratorMask,
2253 expressionType, new ArgumentsTypes<T>.empty()); 2255 expressionType, new ArgumentsTypes<T>.empty());
2254 2256
2255 return handleForInLoop(node, iteratorType, currentSelector, currentMask, 2257 return handleForInLoop(node, iteratorType, currentSelector, currentMask,
2256 moveNextSelector, moveNextMask); 2258 moveNextSelector, moveNextMask);
2257 } 2259 }
2258 } 2260 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/inferrer_visitor.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698