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

Side by Side Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 1880803002: Fix AST-based type inference on empty lists. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * This library is capable of producing linked summaries from unlinked 6 * This library is capable of producing linked summaries from unlinked
7 * ones (or prelinked ones). It functions by building a miniature 7 * ones (or prelinked ones). It functions by building a miniature
8 * element model to represent the contents of the summaries, and then 8 * element model to represent the contents of the summaries, and then
9 * scanning the element model to gather linked information and adding 9 * scanning the element model to gather linked information and adding
10 * it to the summary data structures. 10 * it to the summary data structures.
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 2041
2042 void _doMakeTypeMap() { 2042 void _doMakeTypeMap() {
2043 DartType keyType = _getNextTypeRef(); 2043 DartType keyType = _getNextTypeRef();
2044 DartType valueType = _getNextTypeRef(); 2044 DartType valueType = _getNextTypeRef();
2045 stack.length -= 2 * _getNextInt(); 2045 stack.length -= 2 * _getNextInt();
2046 stack.add(typeProvider.mapType.instantiate(<DartType>[keyType, valueType])); 2046 stack.add(typeProvider.mapType.instantiate(<DartType>[keyType, valueType]));
2047 } 2047 }
2048 2048
2049 void _doMakeUntypedList() { 2049 void _doMakeUntypedList() {
2050 int numItems = _getNextInt(); 2050 int numItems = _getNextInt();
2051 DartType itemType = _popList(numItems).reduce(_leastUpperBound); 2051 DartType itemType = numItems == 0
2052 ? DynamicTypeImpl.instance
2053 : _popList(numItems).reduce(_leastUpperBound);
2052 itemType = _dynamicIfNull(itemType); 2054 itemType = _dynamicIfNull(itemType);
2053 stack.add(typeProvider.listType.instantiate(<DartType>[itemType])); 2055 stack.add(typeProvider.listType.instantiate(<DartType>[itemType]));
2054 } 2056 }
2055 2057
2056 void _doMakeUntypedMap() { 2058 void _doMakeUntypedMap() {
2057 int numEntries = _getNextInt(); 2059 int numEntries = _getNextInt();
2058 List<DartType> keysValues = _popList(2 * numEntries); 2060 List<DartType> keysValues = _popList(2 * numEntries);
2059 DartType keyType = null; 2061 DartType keyType = null;
2060 DartType valueType = null; 2062 DartType valueType = null;
2061 for (int i = 0; i < 2 * numEntries; i++) { 2063 for (int i = 0; i < 2 * numEntries; i++) {
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3943 List<int> implicitFunctionTypeIndices) => 3945 List<int> implicitFunctionTypeIndices) =>
3944 DynamicTypeImpl.instance; 3946 DynamicTypeImpl.instance;
3945 3947
3946 ReferenceableElementForLink getContainedName(String name) { 3948 ReferenceableElementForLink getContainedName(String name) {
3947 return new NonstaticMemberElementForLink(_constNode); 3949 return new NonstaticMemberElementForLink(_constNode);
3948 } 3950 }
3949 3951
3950 @override 3952 @override
3951 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 3953 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
3952 } 3954 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698