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

Side by Side Diff: pkg/analyzer/tool/summary/idl.dart

Issue 1647253002: Add the ability to summarize inferred types based on function-typed parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 file is an "idl" style description of the summary format. It is not 6 * This file is an "idl" style description of the summary format. It is not
7 * executed directly; instead it is parsed and transformed into code that 7 * executed directly; instead it is parsed and transformed into code that
8 * implements the summary format. 8 * implements the summary format.
9 * 9 *
10 * The code generation process introduces the following non-typical semantics: 10 * The code generation process introduces the following non-typical semantics:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 * 101 *
102 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T, 102 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
103 * respectively. 103 * respectively.
104 * 104 *
105 * If the type being referred to is not a type parameter, [paramReference] is 105 * If the type being referred to is not a type parameter, [paramReference] is
106 * zero. 106 * zero.
107 */ 107 */
108 int paramReference; 108 int paramReference;
109 109
110 /** 110 /**
111 * If this is a reference to a function type implicitly defined by a
112 * function-typed parameter, a list of zero-based indices indicating the path
113 * from the entity referred to by [reference] to the appropriate type
114 * parameter. Otherwise the empty list.
115 *
116 * If there are N indices in this list, then the entity being referred to is
117 * the function type implicitly defined by a function-typed parameter of a
118 * function-typed parameter, to N levels of nesting. The first index in the
119 * list refers to the outermost level of nesting; for example if [reference]
120 * refers to the entity defined by:
121 *
122 * void f(x, void g(y, z, int h(String w))) { ... }
123 *
124 * Then to refer to the function type implicitly defined by parameter `h`
125 * (which is parameter 2 of parameter 1 of `f`), then
126 * [implicitFunctionTypeIndices] should be [1, 2].
127 *
128 * Note that if the entity being referred to is a generic method inside a
129 * generic class, then the type arguments in [typeArguments] are applied
130 * first to the class and then to the method.
131 */
132 List<int> implicitFunctionTypeIndices;
133
134 /**
111 * If this is an instantiation of a generic type or generic executable, the 135 * If this is an instantiation of a generic type or generic executable, the
112 * type arguments used to instantiate it. Trailing type arguments of type 136 * type arguments used to instantiate it. Trailing type arguments of type
113 * `dynamic` are omitted. 137 * `dynamic` are omitted.
114 */ 138 */
115 List<EntityRef> typeArguments; 139 List<EntityRef> typeArguments;
116 } 140 }
117 141
118 /** 142 /**
119 * Information about a dependency that exists between one library and another 143 * Information about a dependency that exists between one library and another
120 * due to an "import" declaration. 144 * due to an "import" declaration.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 int numPrelinkedDependencies; 245 int numPrelinkedDependencies;
222 } 246 }
223 247
224 /** 248 /**
225 * Information about the resolution of an [UnlinkedReference]. 249 * Information about the resolution of an [UnlinkedReference].
226 */ 250 */
227 class LinkedReference { 251 class LinkedReference {
228 /** 252 /**
229 * Index into [LinkedLibrary.dependencies] indicating which imported library 253 * Index into [LinkedLibrary.dependencies] indicating which imported library
230 * declares the entity being referred to. 254 * declares the entity being referred to.
255 *
256 * Zero if this entity is contained within another entity (e.g. a class
257 * member).
231 */ 258 */
232 int dependency; 259 int dependency;
233 260
234 /** 261 /**
235 * The kind of the entity being referred to. For the pseudo-types `dynamic` 262 * The kind of the entity being referred to. For the pseudo-types `dynamic`
236 * and `void`, the kind is [ReferenceKind.classOrEnum]. 263 * and `void`, the kind is [ReferenceKind.classOrEnum].
237 */ 264 */
238 ReferenceKind kind; 265 ReferenceKind kind;
239 266
240 /** 267 /**
241 * Integer index indicating which unit in the imported library contains the 268 * Integer index indicating which unit in the imported library contains the
242 * definition of the entity. As with indices into [LinkedLibrary.units], 269 * definition of the entity. As with indices into [LinkedLibrary.units],
243 * zero represents the defining compilation unit, and nonzero values 270 * zero represents the defining compilation unit, and nonzero values
244 * represent parts in the order of the corresponding `part` declarations. 271 * represent parts in the order of the corresponding `part` declarations.
272 *
273 * Zero if this entity is contained within another entity (e.g. a class
274 * member).
245 */ 275 */
246 int unit; 276 int unit;
247 277
248 /** 278 /**
249 * If the entity being referred to is generic, the number of type parameters 279 * If the entity being referred to is generic, the number of type parameters
250 * it accepts. Otherwise zero. 280 * it accepts. Otherwise zero.
251 */ 281 */
252 int numTypeParameters; 282 int numTypeParameters;
253 283
254 /** 284 /**
255 * If this [LinkedReference] doesn't have an associated [UnlinkedReference], 285 * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
256 * name of the entity being referred to. For the pseudo-type `dynamic`, the 286 * name of the entity being referred to. For the pseudo-type `dynamic`, the
257 * string is "dynamic". For the pseudo-type `void`, the string is "void". 287 * string is "dynamic". For the pseudo-type `void`, the string is "void".
258 */ 288 */
259 String name; 289 String name;
290
291 /**
292 * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
293 * and the entity being referred to is contained within another entity, index
294 * of the containing entity. This behaves similarly to
295 * [UnlinkedReference.prefixReference], however it is only used for class
296 * members, not for prefixed imports.
297 *
298 * Containing references must always point backward; that is, for all i, if
299 * LinkedUnit.references[i].containingReference != 0, then
300 * LinkedUnit.references[i].containingReference < i.
301 */
302 int containingReference;
260 } 303 }
261 304
262 /** 305 /**
263 * Linked summary of a compilation unit. 306 * Linked summary of a compilation unit.
264 */ 307 */
265 class LinkedUnit { 308 class LinkedUnit {
266 /** 309 /**
267 * Information about the resolution of references within the compilation 310 * Information about the resolution of references within the compilation
268 * unit. Each element of [UnlinkedUnit.references] has a corresponding 311 * unit. Each element of [UnlinkedUnit.references] has a corresponding
269 * element in this list (at the same index). If this list has additional 312 * element in this list (at the same index). If this list has additional
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 int propagatedTypeSlot; 1502 int propagatedTypeSlot;
1460 1503
1461 /** 1504 /**
1462 * If this variable is inferrable, nonzero slot id identifying which entry in 1505 * If this variable is inferrable, nonzero slot id identifying which entry in
1463 * [LinkedLibrary.types] contains the inferred type for this variable. If 1506 * [LinkedLibrary.types] contains the inferred type for this variable. If
1464 * there is no matching entry in [LinkedLibrary.types], then no type was 1507 * there is no matching entry in [LinkedLibrary.types], then no type was
1465 * inferred for this variable, so its static type is `dynamic`. 1508 * inferred for this variable, so its static type is `dynamic`.
1466 */ 1509 */
1467 int inferredTypeSlot; 1510 int inferredTypeSlot;
1468 } 1511 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698