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

Side by Side Diff: pkg/analyzer/lib/src/summary/format.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 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files". 6 // To regenerate the file, use the script "pkg/analyzer/tool/generate_files".
7 7
8 library analyzer.src.summary.format; 8 library analyzer.src.summary.format;
9 9
10 import 'base.dart' as base; 10 import 'base.dart' as base;
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 return UnlinkedParamKind.values[index]; 444 return UnlinkedParamKind.values[index];
445 } 445 }
446 } 446 }
447 447
448 class EntityRefBuilder extends Object with _EntityRefMixin implements EntityRef { 448 class EntityRefBuilder extends Object with _EntityRefMixin implements EntityRef {
449 bool _finished = false; 449 bool _finished = false;
450 450
451 int _slot; 451 int _slot;
452 int _reference; 452 int _reference;
453 int _paramReference; 453 int _paramReference;
454 List<int> _implicitFunctionTypeIndices;
454 List<EntityRefBuilder> _typeArguments; 455 List<EntityRefBuilder> _typeArguments;
455 456
456 @override 457 @override
457 int get slot => _slot ??= 0; 458 int get slot => _slot ??= 0;
458 459
459 /** 460 /**
460 * If this [EntityRef] is contained within [LinkedUnit.types], slot id (which 461 * If this [EntityRef] is contained within [LinkedUnit.types], slot id (which
461 * is unique within the compilation unit) identifying the target of type 462 * is unique within the compilation unit) identifying the target of type
462 * propagation or type inference with which this [EntityRef] is associated. 463 * propagation or type inference with which this [EntityRef] is associated.
463 * 464 *
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 * If the type being referred to is not a type parameter, [paramReference] is 505 * If the type being referred to is not a type parameter, [paramReference] is
505 * zero. 506 * zero.
506 */ 507 */
507 void set paramReference(int _value) { 508 void set paramReference(int _value) {
508 assert(!_finished); 509 assert(!_finished);
509 assert(_value == null || _value >= 0); 510 assert(_value == null || _value >= 0);
510 _paramReference = _value; 511 _paramReference = _value;
511 } 512 }
512 513
513 @override 514 @override
515 List<int> get implicitFunctionTypeIndices => _implicitFunctionTypeIndices ??= <int>[];
516
517 /**
518 * If this is a reference to a function type implicitly defined by a
519 * function-typed parameter, a list of zero-based indices indicating the path
520 * from the entity referred to by [reference] to the appropriate type
521 * parameter. Otherwise the empty list.
522 *
523 * If there are N indices in this list, then the entity being referred to is
524 * the function type implicitly defined by a function-typed parameter of a
525 * function-typed parameter, to N levels of nesting. The first index in the
526 * list refers to the outermost level of nesting; for example if [reference]
527 * refers to the entity defined by:
528 *
529 * void f(x, void g(y, z, int h(String w))) { ... }
530 *
531 * Then to refer to the function type implicitly defined by parameter `h`
532 * (which is parameter 2 of parameter 1 of `f`), then
533 * [implicitFunctionTypeIndices] should be [1, 2].
534 *
535 * Note that if the entity being referred to is a generic method inside a
536 * generic class, then the type arguments in [typeArguments] are applied
537 * first to the class and then to the method.
538 */
539 void set implicitFunctionTypeIndices(List<int> _value) {
540 assert(!_finished);
541 assert(_value == null || _value.every((e) => e >= 0));
542 _implicitFunctionTypeIndices = _value;
543 }
544
545 @override
514 List<EntityRefBuilder> get typeArguments => _typeArguments ??= <EntityRefBuild er>[]; 546 List<EntityRefBuilder> get typeArguments => _typeArguments ??= <EntityRefBuild er>[];
515 547
516 /** 548 /**
517 * If this is an instantiation of a generic type or generic executable, the 549 * If this is an instantiation of a generic type or generic executable, the
518 * type arguments used to instantiate it. Trailing type arguments of type 550 * type arguments used to instantiate it. Trailing type arguments of type
519 * `dynamic` are omitted. 551 * `dynamic` are omitted.
520 */ 552 */
521 void set typeArguments(List<EntityRefBuilder> _value) { 553 void set typeArguments(List<EntityRefBuilder> _value) {
522 assert(!_finished); 554 assert(!_finished);
523 _typeArguments = _value; 555 _typeArguments = _value;
524 } 556 }
525 557
526 EntityRefBuilder({int slot, int reference, int paramReference, List<EntityRefB uilder> typeArguments}) 558 EntityRefBuilder({int slot, int reference, int paramReference, List<int> impli citFunctionTypeIndices, List<EntityRefBuilder> typeArguments})
527 : _slot = slot, 559 : _slot = slot,
528 _reference = reference, 560 _reference = reference,
529 _paramReference = paramReference, 561 _paramReference = paramReference,
562 _implicitFunctionTypeIndices = implicitFunctionTypeIndices,
530 _typeArguments = typeArguments; 563 _typeArguments = typeArguments;
531 564
532 fb.Offset finish(fb.Builder fbBuilder) { 565 fb.Offset finish(fb.Builder fbBuilder) {
533 assert(!_finished); 566 assert(!_finished);
534 _finished = true; 567 _finished = true;
568 fb.Offset offset_implicitFunctionTypeIndices;
535 fb.Offset offset_typeArguments; 569 fb.Offset offset_typeArguments;
570 if (!(_implicitFunctionTypeIndices == null || _implicitFunctionTypeIndices.i sEmpty)) {
571 offset_implicitFunctionTypeIndices = fbBuilder.writeListUint32(_implicitFu nctionTypeIndices);
572 }
536 if (!(_typeArguments == null || _typeArguments.isEmpty)) { 573 if (!(_typeArguments == null || _typeArguments.isEmpty)) {
537 offset_typeArguments = fbBuilder.writeList(_typeArguments.map((b) => b.fin ish(fbBuilder)).toList()); 574 offset_typeArguments = fbBuilder.writeList(_typeArguments.map((b) => b.fin ish(fbBuilder)).toList());
538 } 575 }
539 fbBuilder.startTable(); 576 fbBuilder.startTable();
540 if (_slot != null && _slot != 0) { 577 if (_slot != null && _slot != 0) {
541 fbBuilder.addUint32(0, _slot); 578 fbBuilder.addUint32(0, _slot);
542 } 579 }
543 if (_reference != null && _reference != 0) { 580 if (_reference != null && _reference != 0) {
544 fbBuilder.addUint32(1, _reference); 581 fbBuilder.addUint32(1, _reference);
545 } 582 }
546 if (_paramReference != null && _paramReference != 0) { 583 if (_paramReference != null && _paramReference != 0) {
547 fbBuilder.addUint32(2, _paramReference); 584 fbBuilder.addUint32(2, _paramReference);
548 } 585 }
586 if (offset_implicitFunctionTypeIndices != null) {
587 fbBuilder.addOffset(3, offset_implicitFunctionTypeIndices);
588 }
549 if (offset_typeArguments != null) { 589 if (offset_typeArguments != null) {
550 fbBuilder.addOffset(3, offset_typeArguments); 590 fbBuilder.addOffset(4, offset_typeArguments);
551 } 591 }
552 return fbBuilder.endTable(); 592 return fbBuilder.endTable();
553 } 593 }
554 } 594 }
555 595
556 /** 596 /**
557 * Summary information about a reference to a an entity such as a type, top 597 * Summary information about a reference to a an entity such as a type, top
558 * level executable, or executable within a class. 598 * level executable, or executable within a class.
559 */ 599 */
560 abstract class EntityRef extends base.SummaryClass { 600 abstract class EntityRef extends base.SummaryClass {
(...skipping 28 matching lines...) Expand all
589 * 629 *
590 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T, 630 * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
591 * respectively. 631 * respectively.
592 * 632 *
593 * If the type being referred to is not a type parameter, [paramReference] is 633 * If the type being referred to is not a type parameter, [paramReference] is
594 * zero. 634 * zero.
595 */ 635 */
596 int get paramReference; 636 int get paramReference;
597 637
598 /** 638 /**
639 * If this is a reference to a function type implicitly defined by a
640 * function-typed parameter, a list of zero-based indices indicating the path
641 * from the entity referred to by [reference] to the appropriate type
642 * parameter. Otherwise the empty list.
643 *
644 * If there are N indices in this list, then the entity being referred to is
645 * the function type implicitly defined by a function-typed parameter of a
646 * function-typed parameter, to N levels of nesting. The first index in the
647 * list refers to the outermost level of nesting; for example if [reference]
648 * refers to the entity defined by:
649 *
650 * void f(x, void g(y, z, int h(String w))) { ... }
651 *
652 * Then to refer to the function type implicitly defined by parameter `h`
653 * (which is parameter 2 of parameter 1 of `f`), then
654 * [implicitFunctionTypeIndices] should be [1, 2].
655 *
656 * Note that if the entity being referred to is a generic method inside a
657 * generic class, then the type arguments in [typeArguments] are applied
658 * first to the class and then to the method.
659 */
660 List<int> get implicitFunctionTypeIndices;
661
662 /**
599 * If this is an instantiation of a generic type or generic executable, the 663 * If this is an instantiation of a generic type or generic executable, the
600 * type arguments used to instantiate it. Trailing type arguments of type 664 * type arguments used to instantiate it. Trailing type arguments of type
601 * `dynamic` are omitted. 665 * `dynamic` are omitted.
602 */ 666 */
603 List<EntityRef> get typeArguments; 667 List<EntityRef> get typeArguments;
604 } 668 }
605 669
606 class _EntityRefReader extends fb.TableReader<_EntityRefImpl> { 670 class _EntityRefReader extends fb.TableReader<_EntityRefImpl> {
607 const _EntityRefReader(); 671 const _EntityRefReader();
608 672
609 @override 673 @override
610 _EntityRefImpl createObject(fb.BufferPointer bp) => new _EntityRefImpl(bp); 674 _EntityRefImpl createObject(fb.BufferPointer bp) => new _EntityRefImpl(bp);
611 } 675 }
612 676
613 class _EntityRefImpl extends Object with _EntityRefMixin implements EntityRef { 677 class _EntityRefImpl extends Object with _EntityRefMixin implements EntityRef {
614 final fb.BufferPointer _bp; 678 final fb.BufferPointer _bp;
615 679
616 _EntityRefImpl(this._bp); 680 _EntityRefImpl(this._bp);
617 681
618 int _slot; 682 int _slot;
619 int _reference; 683 int _reference;
620 int _paramReference; 684 int _paramReference;
685 List<int> _implicitFunctionTypeIndices;
621 List<EntityRef> _typeArguments; 686 List<EntityRef> _typeArguments;
622 687
623 @override 688 @override
624 int get slot { 689 int get slot {
625 _slot ??= const fb.Uint32Reader().vTableGet(_bp, 0, 0); 690 _slot ??= const fb.Uint32Reader().vTableGet(_bp, 0, 0);
626 return _slot; 691 return _slot;
627 } 692 }
628 693
629 @override 694 @override
630 int get reference { 695 int get reference {
631 _reference ??= const fb.Uint32Reader().vTableGet(_bp, 1, 0); 696 _reference ??= const fb.Uint32Reader().vTableGet(_bp, 1, 0);
632 return _reference; 697 return _reference;
633 } 698 }
634 699
635 @override 700 @override
636 int get paramReference { 701 int get paramReference {
637 _paramReference ??= const fb.Uint32Reader().vTableGet(_bp, 2, 0); 702 _paramReference ??= const fb.Uint32Reader().vTableGet(_bp, 2, 0);
638 return _paramReference; 703 return _paramReference;
639 } 704 }
640 705
641 @override 706 @override
707 List<int> get implicitFunctionTypeIndices {
708 _implicitFunctionTypeIndices ??= const fb.ListReader<int>(const fb.Uint32Rea der()).vTableGet(_bp, 3, const <int>[]);
709 return _implicitFunctionTypeIndices;
710 }
711
712 @override
642 List<EntityRef> get typeArguments { 713 List<EntityRef> get typeArguments {
643 _typeArguments ??= const fb.ListReader<EntityRef>(const _EntityRefReader()). vTableGet(_bp, 3, const <EntityRef>[]); 714 _typeArguments ??= const fb.ListReader<EntityRef>(const _EntityRefReader()). vTableGet(_bp, 4, const <EntityRef>[]);
644 return _typeArguments; 715 return _typeArguments;
645 } 716 }
646 } 717 }
647 718
648 abstract class _EntityRefMixin implements EntityRef { 719 abstract class _EntityRefMixin implements EntityRef {
649 @override 720 @override
650 Map<String, Object> toMap() => { 721 Map<String, Object> toMap() => {
651 "slot": slot, 722 "slot": slot,
652 "reference": reference, 723 "reference": reference,
653 "paramReference": paramReference, 724 "paramReference": paramReference,
725 "implicitFunctionTypeIndices": implicitFunctionTypeIndices,
654 "typeArguments": typeArguments, 726 "typeArguments": typeArguments,
655 }; 727 };
656 } 728 }
657 729
658 class LinkedDependencyBuilder extends Object with _LinkedDependencyMixin impleme nts LinkedDependency { 730 class LinkedDependencyBuilder extends Object with _LinkedDependencyMixin impleme nts LinkedDependency {
659 bool _finished = false; 731 bool _finished = false;
660 732
661 String _uri; 733 String _uri;
662 List<String> _parts; 734 List<String> _parts;
663 735
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 } 1276 }
1205 1277
1206 class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement s LinkedReference { 1278 class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement s LinkedReference {
1207 bool _finished = false; 1279 bool _finished = false;
1208 1280
1209 int _dependency; 1281 int _dependency;
1210 ReferenceKind _kind; 1282 ReferenceKind _kind;
1211 int _unit; 1283 int _unit;
1212 int _numTypeParameters; 1284 int _numTypeParameters;
1213 String _name; 1285 String _name;
1286 int _containingReference;
1214 1287
1215 @override 1288 @override
1216 int get dependency => _dependency ??= 0; 1289 int get dependency => _dependency ??= 0;
1217 1290
1218 /** 1291 /**
1219 * Index into [LinkedLibrary.dependencies] indicating which imported library 1292 * Index into [LinkedLibrary.dependencies] indicating which imported library
1220 * declares the entity being referred to. 1293 * declares the entity being referred to.
1294 *
1295 * Zero if this entity is contained within another entity (e.g. a class
1296 * member).
1221 */ 1297 */
1222 void set dependency(int _value) { 1298 void set dependency(int _value) {
1223 assert(!_finished); 1299 assert(!_finished);
1224 assert(_value == null || _value >= 0); 1300 assert(_value == null || _value >= 0);
1225 _dependency = _value; 1301 _dependency = _value;
1226 } 1302 }
1227 1303
1228 @override 1304 @override
1229 ReferenceKind get kind => _kind ??= ReferenceKind.classOrEnum; 1305 ReferenceKind get kind => _kind ??= ReferenceKind.classOrEnum;
1230 1306
1231 /** 1307 /**
1232 * The kind of the entity being referred to. For the pseudo-types `dynamic` 1308 * The kind of the entity being referred to. For the pseudo-types `dynamic`
1233 * and `void`, the kind is [ReferenceKind.classOrEnum]. 1309 * and `void`, the kind is [ReferenceKind.classOrEnum].
1234 */ 1310 */
1235 void set kind(ReferenceKind _value) { 1311 void set kind(ReferenceKind _value) {
1236 assert(!_finished); 1312 assert(!_finished);
1237 _kind = _value; 1313 _kind = _value;
1238 } 1314 }
1239 1315
1240 @override 1316 @override
1241 int get unit => _unit ??= 0; 1317 int get unit => _unit ??= 0;
1242 1318
1243 /** 1319 /**
1244 * Integer index indicating which unit in the imported library contains the 1320 * Integer index indicating which unit in the imported library contains the
1245 * definition of the entity. As with indices into [LinkedLibrary.units], 1321 * definition of the entity. As with indices into [LinkedLibrary.units],
1246 * zero represents the defining compilation unit, and nonzero values 1322 * zero represents the defining compilation unit, and nonzero values
1247 * represent parts in the order of the corresponding `part` declarations. 1323 * represent parts in the order of the corresponding `part` declarations.
1324 *
1325 * Zero if this entity is contained within another entity (e.g. a class
1326 * member).
1248 */ 1327 */
1249 void set unit(int _value) { 1328 void set unit(int _value) {
1250 assert(!_finished); 1329 assert(!_finished);
1251 assert(_value == null || _value >= 0); 1330 assert(_value == null || _value >= 0);
1252 _unit = _value; 1331 _unit = _value;
1253 } 1332 }
1254 1333
1255 @override 1334 @override
1256 int get numTypeParameters => _numTypeParameters ??= 0; 1335 int get numTypeParameters => _numTypeParameters ??= 0;
1257 1336
(...skipping 13 matching lines...) Expand all
1271 /** 1350 /**
1272 * If this [LinkedReference] doesn't have an associated [UnlinkedReference], 1351 * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
1273 * name of the entity being referred to. For the pseudo-type `dynamic`, the 1352 * name of the entity being referred to. For the pseudo-type `dynamic`, the
1274 * string is "dynamic". For the pseudo-type `void`, the string is "void". 1353 * string is "dynamic". For the pseudo-type `void`, the string is "void".
1275 */ 1354 */
1276 void set name(String _value) { 1355 void set name(String _value) {
1277 assert(!_finished); 1356 assert(!_finished);
1278 _name = _value; 1357 _name = _value;
1279 } 1358 }
1280 1359
1281 LinkedReferenceBuilder({int dependency, ReferenceKind kind, int unit, int numT ypeParameters, String name}) 1360 @override
1361 int get containingReference => _containingReference ??= 0;
1362
1363 /**
1364 * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
1365 * and the entity being referred to is contained within another entity, index
1366 * of the containing entity. This behaves similarly to
1367 * [UnlinkedReference.prefixReference], however it is only used for class
1368 * members, not for prefixed imports.
1369 *
1370 * Containing references must always point backward; that is, for all i, if
1371 * LinkedUnit.references[i].containingReference != 0, then
1372 * LinkedUnit.references[i].containingReference < i.
1373 */
1374 void set containingReference(int _value) {
1375 assert(!_finished);
1376 assert(_value == null || _value >= 0);
1377 _containingReference = _value;
1378 }
1379
1380 LinkedReferenceBuilder({int dependency, ReferenceKind kind, int unit, int numT ypeParameters, String name, int containingReference})
1282 : _dependency = dependency, 1381 : _dependency = dependency,
1283 _kind = kind, 1382 _kind = kind,
1284 _unit = unit, 1383 _unit = unit,
1285 _numTypeParameters = numTypeParameters, 1384 _numTypeParameters = numTypeParameters,
1286 _name = name; 1385 _name = name,
1386 _containingReference = containingReference;
1287 1387
1288 fb.Offset finish(fb.Builder fbBuilder) { 1388 fb.Offset finish(fb.Builder fbBuilder) {
1289 assert(!_finished); 1389 assert(!_finished);
1290 _finished = true; 1390 _finished = true;
1291 fb.Offset offset_name; 1391 fb.Offset offset_name;
1292 if (_name != null) { 1392 if (_name != null) {
1293 offset_name = fbBuilder.writeString(_name); 1393 offset_name = fbBuilder.writeString(_name);
1294 } 1394 }
1295 fbBuilder.startTable(); 1395 fbBuilder.startTable();
1296 if (_dependency != null && _dependency != 0) { 1396 if (_dependency != null && _dependency != 0) {
1297 fbBuilder.addUint32(0, _dependency); 1397 fbBuilder.addUint32(0, _dependency);
1298 } 1398 }
1299 if (_kind != null && _kind != ReferenceKind.classOrEnum) { 1399 if (_kind != null && _kind != ReferenceKind.classOrEnum) {
1300 fbBuilder.addUint32(1, _kind.index); 1400 fbBuilder.addUint32(1, _kind.index);
1301 } 1401 }
1302 if (_unit != null && _unit != 0) { 1402 if (_unit != null && _unit != 0) {
1303 fbBuilder.addUint32(2, _unit); 1403 fbBuilder.addUint32(2, _unit);
1304 } 1404 }
1305 if (_numTypeParameters != null && _numTypeParameters != 0) { 1405 if (_numTypeParameters != null && _numTypeParameters != 0) {
1306 fbBuilder.addUint32(3, _numTypeParameters); 1406 fbBuilder.addUint32(3, _numTypeParameters);
1307 } 1407 }
1308 if (offset_name != null) { 1408 if (offset_name != null) {
1309 fbBuilder.addOffset(4, offset_name); 1409 fbBuilder.addOffset(4, offset_name);
1310 } 1410 }
1411 if (_containingReference != null && _containingReference != 0) {
1412 fbBuilder.addUint32(5, _containingReference);
1413 }
1311 return fbBuilder.endTable(); 1414 return fbBuilder.endTable();
1312 } 1415 }
1313 } 1416 }
1314 1417
1315 /** 1418 /**
1316 * Information about the resolution of an [UnlinkedReference]. 1419 * Information about the resolution of an [UnlinkedReference].
1317 */ 1420 */
1318 abstract class LinkedReference extends base.SummaryClass { 1421 abstract class LinkedReference extends base.SummaryClass {
1319 1422
1320 /** 1423 /**
1321 * Index into [LinkedLibrary.dependencies] indicating which imported library 1424 * Index into [LinkedLibrary.dependencies] indicating which imported library
1322 * declares the entity being referred to. 1425 * declares the entity being referred to.
1426 *
1427 * Zero if this entity is contained within another entity (e.g. a class
1428 * member).
1323 */ 1429 */
1324 int get dependency; 1430 int get dependency;
1325 1431
1326 /** 1432 /**
1327 * The kind of the entity being referred to. For the pseudo-types `dynamic` 1433 * The kind of the entity being referred to. For the pseudo-types `dynamic`
1328 * and `void`, the kind is [ReferenceKind.classOrEnum]. 1434 * and `void`, the kind is [ReferenceKind.classOrEnum].
1329 */ 1435 */
1330 ReferenceKind get kind; 1436 ReferenceKind get kind;
1331 1437
1332 /** 1438 /**
1333 * Integer index indicating which unit in the imported library contains the 1439 * Integer index indicating which unit in the imported library contains the
1334 * definition of the entity. As with indices into [LinkedLibrary.units], 1440 * definition of the entity. As with indices into [LinkedLibrary.units],
1335 * zero represents the defining compilation unit, and nonzero values 1441 * zero represents the defining compilation unit, and nonzero values
1336 * represent parts in the order of the corresponding `part` declarations. 1442 * represent parts in the order of the corresponding `part` declarations.
1443 *
1444 * Zero if this entity is contained within another entity (e.g. a class
1445 * member).
1337 */ 1446 */
1338 int get unit; 1447 int get unit;
1339 1448
1340 /** 1449 /**
1341 * If the entity being referred to is generic, the number of type parameters 1450 * If the entity being referred to is generic, the number of type parameters
1342 * it accepts. Otherwise zero. 1451 * it accepts. Otherwise zero.
1343 */ 1452 */
1344 int get numTypeParameters; 1453 int get numTypeParameters;
1345 1454
1346 /** 1455 /**
1347 * If this [LinkedReference] doesn't have an associated [UnlinkedReference], 1456 * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
1348 * name of the entity being referred to. For the pseudo-type `dynamic`, the 1457 * name of the entity being referred to. For the pseudo-type `dynamic`, the
1349 * string is "dynamic". For the pseudo-type `void`, the string is "void". 1458 * string is "dynamic". For the pseudo-type `void`, the string is "void".
1350 */ 1459 */
1351 String get name; 1460 String get name;
1461
1462 /**
1463 * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
1464 * and the entity being referred to is contained within another entity, index
1465 * of the containing entity. This behaves similarly to
1466 * [UnlinkedReference.prefixReference], however it is only used for class
1467 * members, not for prefixed imports.
1468 *
1469 * Containing references must always point backward; that is, for all i, if
1470 * LinkedUnit.references[i].containingReference != 0, then
1471 * LinkedUnit.references[i].containingReference < i.
1472 */
1473 int get containingReference;
1352 } 1474 }
1353 1475
1354 class _LinkedReferenceReader extends fb.TableReader<_LinkedReferenceImpl> { 1476 class _LinkedReferenceReader extends fb.TableReader<_LinkedReferenceImpl> {
1355 const _LinkedReferenceReader(); 1477 const _LinkedReferenceReader();
1356 1478
1357 @override 1479 @override
1358 _LinkedReferenceImpl createObject(fb.BufferPointer bp) => new _LinkedReference Impl(bp); 1480 _LinkedReferenceImpl createObject(fb.BufferPointer bp) => new _LinkedReference Impl(bp);
1359 } 1481 }
1360 1482
1361 class _LinkedReferenceImpl extends Object with _LinkedReferenceMixin implements LinkedReference { 1483 class _LinkedReferenceImpl extends Object with _LinkedReferenceMixin implements LinkedReference {
1362 final fb.BufferPointer _bp; 1484 final fb.BufferPointer _bp;
1363 1485
1364 _LinkedReferenceImpl(this._bp); 1486 _LinkedReferenceImpl(this._bp);
1365 1487
1366 int _dependency; 1488 int _dependency;
1367 ReferenceKind _kind; 1489 ReferenceKind _kind;
1368 int _unit; 1490 int _unit;
1369 int _numTypeParameters; 1491 int _numTypeParameters;
1370 String _name; 1492 String _name;
1493 int _containingReference;
1371 1494
1372 @override 1495 @override
1373 int get dependency { 1496 int get dependency {
1374 _dependency ??= const fb.Uint32Reader().vTableGet(_bp, 0, 0); 1497 _dependency ??= const fb.Uint32Reader().vTableGet(_bp, 0, 0);
1375 return _dependency; 1498 return _dependency;
1376 } 1499 }
1377 1500
1378 @override 1501 @override
1379 ReferenceKind get kind { 1502 ReferenceKind get kind {
1380 _kind ??= const _ReferenceKindReader().vTableGet(_bp, 1, ReferenceKind.class OrEnum); 1503 _kind ??= const _ReferenceKindReader().vTableGet(_bp, 1, ReferenceKind.class OrEnum);
(...skipping 10 matching lines...) Expand all
1391 int get numTypeParameters { 1514 int get numTypeParameters {
1392 _numTypeParameters ??= const fb.Uint32Reader().vTableGet(_bp, 3, 0); 1515 _numTypeParameters ??= const fb.Uint32Reader().vTableGet(_bp, 3, 0);
1393 return _numTypeParameters; 1516 return _numTypeParameters;
1394 } 1517 }
1395 1518
1396 @override 1519 @override
1397 String get name { 1520 String get name {
1398 _name ??= const fb.StringReader().vTableGet(_bp, 4, ''); 1521 _name ??= const fb.StringReader().vTableGet(_bp, 4, '');
1399 return _name; 1522 return _name;
1400 } 1523 }
1524
1525 @override
1526 int get containingReference {
1527 _containingReference ??= const fb.Uint32Reader().vTableGet(_bp, 5, 0);
1528 return _containingReference;
1529 }
1401 } 1530 }
1402 1531
1403 abstract class _LinkedReferenceMixin implements LinkedReference { 1532 abstract class _LinkedReferenceMixin implements LinkedReference {
1404 @override 1533 @override
1405 Map<String, Object> toMap() => { 1534 Map<String, Object> toMap() => {
1406 "dependency": dependency, 1535 "dependency": dependency,
1407 "kind": kind, 1536 "kind": kind,
1408 "unit": unit, 1537 "unit": unit,
1409 "numTypeParameters": numTypeParameters, 1538 "numTypeParameters": numTypeParameters,
1410 "name": name, 1539 "name": name,
1540 "containingReference": containingReference,
1411 }; 1541 };
1412 } 1542 }
1413 1543
1414 class LinkedUnitBuilder extends Object with _LinkedUnitMixin implements LinkedUn it { 1544 class LinkedUnitBuilder extends Object with _LinkedUnitMixin implements LinkedUn it {
1415 bool _finished = false; 1545 bool _finished = false;
1416 1546
1417 List<LinkedReferenceBuilder> _references; 1547 List<LinkedReferenceBuilder> _references;
1418 List<EntityRefBuilder> _types; 1548 List<EntityRefBuilder> _types;
1419 1549
1420 @override 1550 @override
(...skipping 4678 matching lines...) Expand 10 before | Expand all | Expand 10 after
6099 "type": type, 6229 "type": type,
6100 "constExpr": constExpr, 6230 "constExpr": constExpr,
6101 "isStatic": isStatic, 6231 "isStatic": isStatic,
6102 "isFinal": isFinal, 6232 "isFinal": isFinal,
6103 "isConst": isConst, 6233 "isConst": isConst,
6104 "propagatedTypeSlot": propagatedTypeSlot, 6234 "propagatedTypeSlot": propagatedTypeSlot,
6105 "inferredTypeSlot": inferredTypeSlot, 6235 "inferredTypeSlot": inferredTypeSlot,
6106 }; 6236 };
6107 } 6237 }
6108 6238
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698