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

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

Issue 1978483003: Fix AST-based type inference of top level function tearoffs (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/task/strong/inferred_type_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 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 kind = ReferenceKind.propertyAccessor; 1149 kind = ReferenceKind.propertyAccessor;
1150 break; 1150 break;
1151 default: 1151 default:
1152 // TODO(paulberry): implement other cases as necessary 1152 // TODO(paulberry): implement other cases as necessary
1153 throw new UnimplementedError('${element._unlinkedExecutable.kind}'); 1153 throw new UnimplementedError('${element._unlinkedExecutable.kind}');
1154 } 1154 }
1155 return addRawReference(element.name, 1155 return addRawReference(element.name,
1156 numTypeParameters: element.typeParameters.length, 1156 numTypeParameters: element.typeParameters.length,
1157 containingReference: 1157 containingReference:
1158 enclosingClass != null ? addReference(enclosingClass) : null, 1158 enclosingClass != null ? addReference(enclosingClass) : null,
1159 dependency: enclosingClass != null
1160 ? null
1161 : library.addDependency(element.library),
1159 kind: kind); 1162 kind: kind);
1160 } else if (element is FunctionElementForLink_Local) { 1163 } else if (element is FunctionElementForLink_Local) {
1161 FunctionElementImpl parent = element.enclosingElement; 1164 FunctionElementImpl parent = element.enclosingElement;
1162 int localIndex = parent.functions.indexOf(element); 1165 int localIndex = parent.functions.indexOf(element);
1163 assert(localIndex != -1); 1166 assert(localIndex != -1);
1164 return addRawReference(element.name, 1167 return addRawReference(element.name,
1165 containingReference: addReference(parent), 1168 containingReference: addReference(parent),
1166 kind: ReferenceKind.function, 1169 kind: ReferenceKind.function,
1167 localIndex: localIndex); 1170 localIndex: localIndex);
1168 } else if (element is FunctionElementForLink_Initializer) { 1171 } else if (element is FunctionElementForLink_Initializer) {
1169 return addRawReference('', 1172 return addRawReference('',
1170 containingReference: addReference(element.enclosingElement), 1173 containingReference: addReference(element.enclosingElement),
1171 kind: ReferenceKind.function); 1174 kind: ReferenceKind.function);
1172 } else if (element is TopLevelVariableElementForLink) { 1175 } else if (element is TopLevelVariableElementForLink) {
1173 return addRawReference(element.name, 1176 return addRawReference(element.name,
1177 dependency: library.addDependency(element.library),
1174 kind: ReferenceKind.topLevelPropertyAccessor); 1178 kind: ReferenceKind.topLevelPropertyAccessor);
1175 } else if (element is FieldElementForLink_ClassField) { 1179 } else if (element is FieldElementForLink_ClassField) {
1176 ClassElementForLink_Class enclosingClass = element.enclosingElement; 1180 ClassElementForLink_Class enclosingClass = element.enclosingElement;
1177 // TODO(paulberry): do we need to set numTypeParameters to nonzero if the 1181 // TODO(paulberry): do we need to set numTypeParameters to nonzero if the
1178 // class has type parameters? 1182 // class has type parameters?
1179 return addRawReference(element.name, 1183 return addRawReference(element.name,
1180 containingReference: addReference(enclosingClass), 1184 containingReference: addReference(enclosingClass),
1181 kind: ReferenceKind.propertyAccessor); 1185 kind: ReferenceKind.propertyAccessor);
1182 } 1186 }
1183 // TODO(paulberry): implement other cases 1187 // TODO(paulberry): implement other cases
(...skipping 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after
4825 * there are no type parameters in scope. 4829 * there are no type parameters in scope.
4826 */ 4830 */
4827 TypeParameterizedElementForLink get _typeParameterContext; 4831 TypeParameterizedElementForLink get _typeParameterContext;
4828 4832
4829 @override 4833 @override
4830 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 4834 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
4831 4835
4832 @override 4836 @override
4833 String toString() => '$enclosingElement.$name'; 4837 String toString() => '$enclosingElement.$name';
4834 } 4838 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698