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

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

Issue 1610003002: Rename UnlinkedTypeRef to TypeRef. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « pkg/analyzer/test/src/summary/summary_test.dart ('k') | no next file » | 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) 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 */ 258 */
259 List<String> unlinkedUnitUris; 259 List<String> unlinkedUnitUris;
260 260
261 /** 261 /**
262 * Unlinked information for the compilation units constituting the SDK. 262 * Unlinked information for the compilation units constituting the SDK.
263 */ 263 */
264 List<UnlinkedUnit> unlinkedUnits; 264 List<UnlinkedUnit> unlinkedUnits;
265 } 265 }
266 266
267 /** 267 /**
268 * Summary information about a reference to a type.
269 */
270 class TypeRef {
271 /**
272 * Index into [UnlinkedUnit.references] for the type being referred to, or
273 * zero if this is a reference to a type parameter.
274 *
275 * Note that since zero is also a valid index into
276 * [UnlinkedUnit.references], we cannot distinguish between references to
277 * type parameters and references to types by checking [reference] against
278 * zero. To distinguish between references to type parameters and references
279 * to types, check whether [paramReference] is zero.
280 */
281 int reference;
282
283 /**
284 * If this is a reference to a type parameter, one-based index into the list
285 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
286 * Bruijn index conventions; that is, innermost parameters come first, and
287 * if a class or method has multiple parameters, they are indexed from right
288 * to left. So for instance, if the enclosing declaration is
289 *
290 * class C<T,U> {
291 * m<V,W> {
292 * ...
293 * }
294 * }
295 *
296 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
297 * respectively.
298 *
299 * If the type being referred to is not a type parameter, [paramReference] is
300 * zero.
301 */
302 int paramReference;
303
304 /**
305 * If this is an instantiation of a generic type, the type arguments used to
306 * instantiate it. Trailing type arguments of type `dynamic` are omitted.
307 */
308 List<TypeRef> typeArguments;
309 }
310
311 /**
268 * Unlinked summary information about a class declaration. 312 * Unlinked summary information about a class declaration.
269 */ 313 */
270 class UnlinkedClass { 314 class UnlinkedClass {
271 /** 315 /**
272 * Name of the class. 316 * Name of the class.
273 */ 317 */
274 String name; 318 String name;
275 319
276 /** 320 /**
277 * Offset of the class name relative to the beginning of the file. 321 * Offset of the class name relative to the beginning of the file.
(...skipping 11 matching lines...) Expand all
289 /** 333 /**
290 * Type parameters of the class, if any. 334 * Type parameters of the class, if any.
291 */ 335 */
292 List<UnlinkedTypeParam> typeParameters; 336 List<UnlinkedTypeParam> typeParameters;
293 337
294 /** 338 /**
295 * Supertype of the class, or `null` if either (a) the class doesn't 339 * Supertype of the class, or `null` if either (a) the class doesn't
296 * explicitly declare a supertype (and hence has supertype `Object`), or (b) 340 * explicitly declare a supertype (and hence has supertype `Object`), or (b)
297 * the class *is* `Object` (and hence has no supertype). 341 * the class *is* `Object` (and hence has no supertype).
298 */ 342 */
299 UnlinkedTypeRef supertype; 343 TypeRef supertype;
300 344
301 /** 345 /**
302 * Mixins appearing in a `with` clause, if any. 346 * Mixins appearing in a `with` clause, if any.
303 */ 347 */
304 List<UnlinkedTypeRef> mixins; 348 List<TypeRef> mixins;
305 349
306 /** 350 /**
307 * Interfaces appearing in an `implements` clause, if any. 351 * Interfaces appearing in an `implements` clause, if any.
308 */ 352 */
309 List<UnlinkedTypeRef> interfaces; 353 List<TypeRef> interfaces;
310 354
311 /** 355 /**
312 * Field declarations contained in the class. 356 * Field declarations contained in the class.
313 */ 357 */
314 List<UnlinkedVariable> fields; 358 List<UnlinkedVariable> fields;
315 359
316 /** 360 /**
317 * Executable objects (methods, getters, and setters) contained in the class. 361 * Executable objects (methods, getters, and setters) contained in the class.
318 */ 362 */
319 List<UnlinkedExecutable> executables; 363 List<UnlinkedExecutable> executables;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 * `invokeConstructor`. 429 * `invokeConstructor`.
386 */ 430 */
387 List<String> strings; 431 List<String> strings;
388 432
389 /** 433 /**
390 * Sequence of language constructs consumed by the operations 434 * Sequence of language constructs consumed by the operations
391 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note 435 * `pushReference`, `invokeConstructor`, `makeList`, and `makeMap`. Note
392 * that in the case of `pushReference` (and sometimes `invokeConstructor` the 436 * that in the case of `pushReference` (and sometimes `invokeConstructor` the
393 * actual entity being referred to may be something other than a type. 437 * actual entity being referred to may be something other than a type.
394 */ 438 */
395 List<UnlinkedTypeRef> references; 439 List<TypeRef> references;
396 } 440 }
397 441
398 /** 442 /**
399 * Enum representing the various kinds of operations which may be performed to 443 * Enum representing the various kinds of operations which may be performed to
400 * produce a constant value. These options are assumed to execute in the 444 * produce a constant value. These options are assumed to execute in the
401 * context of a stack which is initially empty. 445 * context of a stack which is initially empty.
402 */ 446 */
403 enum UnlinkedConstOperation { 447 enum UnlinkedConstOperation {
404 /** 448 /**
405 * Push the value of the n-th constructor argument (where n is obtained from 449 * Push the value of the n-th constructor argument (where n is obtained from
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 * Type parameters of the executable, if any. Empty if support for generic 816 * Type parameters of the executable, if any. Empty if support for generic
773 * method syntax is disabled. 817 * method syntax is disabled.
774 */ 818 */
775 List<UnlinkedTypeParam> typeParameters; 819 List<UnlinkedTypeParam> typeParameters;
776 820
777 /** 821 /**
778 * Declared return type of the executable. Absent if the return type is 822 * Declared return type of the executable. Absent if the return type is
779 * `void` or the executable is a constructor. Note that when strong mode is 823 * `void` or the executable is a constructor. Note that when strong mode is
780 * enabled, the actual return type may be different due to type inference. 824 * enabled, the actual return type may be different due to type inference.
781 */ 825 */
782 UnlinkedTypeRef returnType; 826 TypeRef returnType;
783 827
784 /** 828 /**
785 * Parameters of the executable, if any. Note that getters have no 829 * Parameters of the executable, if any. Note that getters have no
786 * parameters (hence this will be the empty list), and setters have a single 830 * parameters (hence this will be the empty list), and setters have a single
787 * parameter. 831 * parameter.
788 */ 832 */
789 List<UnlinkedParam> parameters; 833 List<UnlinkedParam> parameters;
790 834
791 /** 835 /**
792 * The kind of the executable (function/method, getter, setter, or 836 * The kind of the executable (function/method, getter, setter, or
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 @informative 1017 @informative
974 int nameOffset; 1018 int nameOffset;
975 1019
976 /** 1020 /**
977 * If [isFunctionTyped] is `true`, the declared return type. If 1021 * If [isFunctionTyped] is `true`, the declared return type. If
978 * [isFunctionTyped] is `false`, the declared type. Absent if 1022 * [isFunctionTyped] is `false`, the declared type. Absent if
979 * [isFunctionTyped] is `true` and the declared return type is `void`. Note 1023 * [isFunctionTyped] is `true` and the declared return type is `void`. Note
980 * that when strong mode is enabled, the actual type may be different due to 1024 * that when strong mode is enabled, the actual type may be different due to
981 * type inference. 1025 * type inference.
982 */ 1026 */
983 UnlinkedTypeRef type; 1027 TypeRef type;
984 1028
985 /** 1029 /**
986 * If [isFunctionTyped] is `true`, the parameters of the function type. 1030 * If [isFunctionTyped] is `true`, the parameters of the function type.
987 */ 1031 */
988 List<UnlinkedParam> parameters; 1032 List<UnlinkedParam> parameters;
989 1033
990 /** 1034 /**
991 * Kind of the parameter. 1035 * Kind of the parameter.
992 */ 1036 */
993 UnlinkedParamKind kind; 1037 UnlinkedParamKind kind;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 UnlinkedDocumentationComment documentationComment; 1196 UnlinkedDocumentationComment documentationComment;
1153 1197
1154 /** 1198 /**
1155 * Type parameters of the typedef, if any. 1199 * Type parameters of the typedef, if any.
1156 */ 1200 */
1157 List<UnlinkedTypeParam> typeParameters; 1201 List<UnlinkedTypeParam> typeParameters;
1158 1202
1159 /** 1203 /**
1160 * Return type of the typedef. Absent if the return type is `void`. 1204 * Return type of the typedef. Absent if the return type is `void`.
1161 */ 1205 */
1162 UnlinkedTypeRef returnType; 1206 TypeRef returnType;
1163 1207
1164 /** 1208 /**
1165 * Parameters of the executable, if any. 1209 * Parameters of the executable, if any.
1166 */ 1210 */
1167 List<UnlinkedParam> parameters; 1211 List<UnlinkedParam> parameters;
1168 } 1212 }
1169 1213
1170 /** 1214 /**
1171 * Unlinked summary information about a type parameter declaration. 1215 * Unlinked summary information about a type parameter declaration.
1172 */ 1216 */
1173 class UnlinkedTypeParam { 1217 class UnlinkedTypeParam {
1174 /** 1218 /**
1175 * Name of the type parameter. 1219 * Name of the type parameter.
1176 */ 1220 */
1177 String name; 1221 String name;
1178 1222
1179 /** 1223 /**
1180 * Offset of the type parameter name relative to the beginning of the file. 1224 * Offset of the type parameter name relative to the beginning of the file.
1181 */ 1225 */
1182 @informative 1226 @informative
1183 int nameOffset; 1227 int nameOffset;
1184 1228
1185 /** 1229 /**
1186 * Bound of the type parameter, if a bound is explicitly declared. Otherwise 1230 * Bound of the type parameter, if a bound is explicitly declared. Otherwise
1187 * null. 1231 * null.
1188 */ 1232 */
1189 UnlinkedTypeRef bound; 1233 TypeRef bound;
1190 } 1234 }
1191 1235
1192 /** 1236 /**
1193 * Unlinked summary information about a reference to a type.
1194 */
1195 class UnlinkedTypeRef {
1196 /**
1197 * Index into [UnlinkedUnit.references] for the type being referred to, or
1198 * zero if this is a reference to a type parameter.
1199 *
1200 * Note that since zero is also a valid index into
1201 * [UnlinkedUnit.references], we cannot distinguish between references to
1202 * type parameters and references to types by checking [reference] against
1203 * zero. To distinguish between references to type parameters and references
1204 * to types, check whether [paramReference] is zero.
1205 */
1206 int reference;
1207
1208 /**
1209 * If this is a reference to a type parameter, one-based index into the list
1210 * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
1211 * Bruijn index conventions; that is, innermost parameters come first, and
1212 * if a class or method has multiple parameters, they are indexed from right
1213 * to left. So for instance, if the enclosing declaration is
1214 *
1215 * class C<T,U> {
1216 * m<V,W> {
1217 * ...
1218 * }
1219 * }
1220 *
1221 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
1222 * respectively.
1223 *
1224 * If the type being referred to is not a type parameter, [paramReference] is
1225 * zero.
1226 */
1227 int paramReference;
1228
1229 /**
1230 * If this is an instantiation of a generic type, the type arguments used to
1231 * instantiate it. Trailing type arguments of type `dynamic` are omitted.
1232 */
1233 List<UnlinkedTypeRef> typeArguments;
1234 }
1235
1236 /**
1237 * Unlinked summary information about a compilation unit ("part file"). 1237 * Unlinked summary information about a compilation unit ("part file").
1238 */ 1238 */
1239 @topLevel 1239 @topLevel
1240 class UnlinkedUnit { 1240 class UnlinkedUnit {
1241 /** 1241 /**
1242 * Name of the library (from a "library" declaration, if present). 1242 * Name of the library (from a "library" declaration, if present).
1243 */ 1243 */
1244 String libraryName; 1244 String libraryName;
1245 1245
1246 /** 1246 /**
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 * Documentation comment for the variable, or `null` if there is no 1338 * Documentation comment for the variable, or `null` if there is no
1339 * documentation comment. 1339 * documentation comment.
1340 */ 1340 */
1341 @informative 1341 @informative
1342 UnlinkedDocumentationComment documentationComment; 1342 UnlinkedDocumentationComment documentationComment;
1343 1343
1344 /** 1344 /**
1345 * Declared type of the variable. Note that when strong mode is enabled, the 1345 * Declared type of the variable. Note that when strong mode is enabled, the
1346 * actual type of the variable may be different due to type inference. 1346 * actual type of the variable may be different due to type inference.
1347 */ 1347 */
1348 UnlinkedTypeRef type; 1348 TypeRef type;
1349 1349
1350 /** 1350 /**
1351 * If [isConst] is true, and the variable has an initializer, the constant 1351 * If [isConst] is true, and the variable has an initializer, the constant
1352 * expression in the initializer. 1352 * expression in the initializer.
1353 */ 1353 */
1354 UnlinkedConst constExpr; 1354 UnlinkedConst constExpr;
1355 1355
1356 /** 1356 /**
1357 * Indicates whether the variable is declared using the `static` keyword. 1357 * Indicates whether the variable is declared using the `static` keyword.
1358 * 1358 *
(...skipping 11 matching lines...) Expand all
1370 /** 1370 /**
1371 * Indicates whether the variable is declared using the `const` keyword. 1371 * Indicates whether the variable is declared using the `const` keyword.
1372 */ 1372 */
1373 bool isConst; 1373 bool isConst;
1374 1374
1375 /** 1375 /**
1376 * Indicates whether this variable lacks an explicit type declaration. 1376 * Indicates whether this variable lacks an explicit type declaration.
1377 */ 1377 */
1378 bool hasImplicitType; 1378 bool hasImplicitType;
1379 } 1379 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/summary_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698