| Index: pkg/analyzer/lib/src/summary/format.dart
|
| diff --git a/pkg/analyzer/lib/src/summary/format.dart b/pkg/analyzer/lib/src/summary/format.dart
|
| index c46340d592a913c47fc00d28c04aabe875ecebec..6d1107cfef3889a9ee4f0781f96e00fc01852cd1 100644
|
| --- a/pkg/analyzer/lib/src/summary/format.dart
|
| +++ b/pkg/analyzer/lib/src/summary/format.dart
|
| @@ -451,6 +451,7 @@ class EntityRefBuilder extends Object with _EntityRefMixin implements EntityRef
|
| int _slot;
|
| int _reference;
|
| int _paramReference;
|
| + List<int> _implicitFunctionTypeIndices;
|
| List<EntityRefBuilder> _typeArguments;
|
|
|
| @override
|
| @@ -511,6 +512,37 @@ class EntityRefBuilder extends Object with _EntityRefMixin implements EntityRef
|
| }
|
|
|
| @override
|
| + List<int> get implicitFunctionTypeIndices => _implicitFunctionTypeIndices ??= <int>[];
|
| +
|
| + /**
|
| + * If this is a reference to a function type implicitly defined by a
|
| + * function-typed parameter, a list of zero-based indices indicating the path
|
| + * from the entity referred to by [reference] to the appropriate type
|
| + * parameter. Otherwise the empty list.
|
| + *
|
| + * If there are N indices in this list, then the entity being referred to is
|
| + * the function type implicitly defined by a function-typed parameter of a
|
| + * function-typed parameter, to N levels of nesting. The first index in the
|
| + * list refers to the outermost level of nesting; for example if [reference]
|
| + * refers to the entity defined by:
|
| + *
|
| + * void f(x, void g(y, z, int h(String w))) { ... }
|
| + *
|
| + * Then to refer to the function type implicitly defined by parameter `h`
|
| + * (which is parameter 2 of parameter 1 of `f`), then
|
| + * [implicitFunctionTypeIndices] should be [1, 2].
|
| + *
|
| + * Note that if the entity being referred to is a generic method inside a
|
| + * generic class, then the type arguments in [typeArguments] are applied
|
| + * first to the class and then to the method.
|
| + */
|
| + void set implicitFunctionTypeIndices(List<int> _value) {
|
| + assert(!_finished);
|
| + assert(_value == null || _value.every((e) => e >= 0));
|
| + _implicitFunctionTypeIndices = _value;
|
| + }
|
| +
|
| + @override
|
| List<EntityRefBuilder> get typeArguments => _typeArguments ??= <EntityRefBuilder>[];
|
|
|
| /**
|
| @@ -523,16 +555,21 @@ class EntityRefBuilder extends Object with _EntityRefMixin implements EntityRef
|
| _typeArguments = _value;
|
| }
|
|
|
| - EntityRefBuilder({int slot, int reference, int paramReference, List<EntityRefBuilder> typeArguments})
|
| + EntityRefBuilder({int slot, int reference, int paramReference, List<int> implicitFunctionTypeIndices, List<EntityRefBuilder> typeArguments})
|
| : _slot = slot,
|
| _reference = reference,
|
| _paramReference = paramReference,
|
| + _implicitFunctionTypeIndices = implicitFunctionTypeIndices,
|
| _typeArguments = typeArguments;
|
|
|
| fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| _finished = true;
|
| + fb.Offset offset_implicitFunctionTypeIndices;
|
| fb.Offset offset_typeArguments;
|
| + if (!(_implicitFunctionTypeIndices == null || _implicitFunctionTypeIndices.isEmpty)) {
|
| + offset_implicitFunctionTypeIndices = fbBuilder.writeListUint32(_implicitFunctionTypeIndices);
|
| + }
|
| if (!(_typeArguments == null || _typeArguments.isEmpty)) {
|
| offset_typeArguments = fbBuilder.writeList(_typeArguments.map((b) => b.finish(fbBuilder)).toList());
|
| }
|
| @@ -546,8 +583,11 @@ class EntityRefBuilder extends Object with _EntityRefMixin implements EntityRef
|
| if (_paramReference != null && _paramReference != 0) {
|
| fbBuilder.addUint32(2, _paramReference);
|
| }
|
| + if (offset_implicitFunctionTypeIndices != null) {
|
| + fbBuilder.addOffset(3, offset_implicitFunctionTypeIndices);
|
| + }
|
| if (offset_typeArguments != null) {
|
| - fbBuilder.addOffset(3, offset_typeArguments);
|
| + fbBuilder.addOffset(4, offset_typeArguments);
|
| }
|
| return fbBuilder.endTable();
|
| }
|
| @@ -596,6 +636,30 @@ abstract class EntityRef extends base.SummaryClass {
|
| int get paramReference;
|
|
|
| /**
|
| + * If this is a reference to a function type implicitly defined by a
|
| + * function-typed parameter, a list of zero-based indices indicating the path
|
| + * from the entity referred to by [reference] to the appropriate type
|
| + * parameter. Otherwise the empty list.
|
| + *
|
| + * If there are N indices in this list, then the entity being referred to is
|
| + * the function type implicitly defined by a function-typed parameter of a
|
| + * function-typed parameter, to N levels of nesting. The first index in the
|
| + * list refers to the outermost level of nesting; for example if [reference]
|
| + * refers to the entity defined by:
|
| + *
|
| + * void f(x, void g(y, z, int h(String w))) { ... }
|
| + *
|
| + * Then to refer to the function type implicitly defined by parameter `h`
|
| + * (which is parameter 2 of parameter 1 of `f`), then
|
| + * [implicitFunctionTypeIndices] should be [1, 2].
|
| + *
|
| + * Note that if the entity being referred to is a generic method inside a
|
| + * generic class, then the type arguments in [typeArguments] are applied
|
| + * first to the class and then to the method.
|
| + */
|
| + List<int> get implicitFunctionTypeIndices;
|
| +
|
| + /**
|
| * If this is an instantiation of a generic type or generic executable, the
|
| * type arguments used to instantiate it. Trailing type arguments of type
|
| * `dynamic` are omitted.
|
| @@ -618,6 +682,7 @@ class _EntityRefImpl extends Object with _EntityRefMixin implements EntityRef {
|
| int _slot;
|
| int _reference;
|
| int _paramReference;
|
| + List<int> _implicitFunctionTypeIndices;
|
| List<EntityRef> _typeArguments;
|
|
|
| @override
|
| @@ -639,8 +704,14 @@ class _EntityRefImpl extends Object with _EntityRefMixin implements EntityRef {
|
| }
|
|
|
| @override
|
| + List<int> get implicitFunctionTypeIndices {
|
| + _implicitFunctionTypeIndices ??= const fb.ListReader<int>(const fb.Uint32Reader()).vTableGet(_bp, 3, const <int>[]);
|
| + return _implicitFunctionTypeIndices;
|
| + }
|
| +
|
| + @override
|
| List<EntityRef> get typeArguments {
|
| - _typeArguments ??= const fb.ListReader<EntityRef>(const _EntityRefReader()).vTableGet(_bp, 3, const <EntityRef>[]);
|
| + _typeArguments ??= const fb.ListReader<EntityRef>(const _EntityRefReader()).vTableGet(_bp, 4, const <EntityRef>[]);
|
| return _typeArguments;
|
| }
|
| }
|
| @@ -651,6 +722,7 @@ abstract class _EntityRefMixin implements EntityRef {
|
| "slot": slot,
|
| "reference": reference,
|
| "paramReference": paramReference,
|
| + "implicitFunctionTypeIndices": implicitFunctionTypeIndices,
|
| "typeArguments": typeArguments,
|
| };
|
| }
|
| @@ -1211,6 +1283,7 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
|
| int _unit;
|
| int _numTypeParameters;
|
| String _name;
|
| + int _containingReference;
|
|
|
| @override
|
| int get dependency => _dependency ??= 0;
|
| @@ -1218,6 +1291,9 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
|
| /**
|
| * Index into [LinkedLibrary.dependencies] indicating which imported library
|
| * declares the entity being referred to.
|
| + *
|
| + * Zero if this entity is contained within another entity (e.g. a class
|
| + * member).
|
| */
|
| void set dependency(int _value) {
|
| assert(!_finished);
|
| @@ -1245,6 +1321,9 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
|
| * definition of the entity. As with indices into [LinkedLibrary.units],
|
| * zero represents the defining compilation unit, and nonzero values
|
| * represent parts in the order of the corresponding `part` declarations.
|
| + *
|
| + * Zero if this entity is contained within another entity (e.g. a class
|
| + * member).
|
| */
|
| void set unit(int _value) {
|
| assert(!_finished);
|
| @@ -1278,12 +1357,33 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
|
| _name = _value;
|
| }
|
|
|
| - LinkedReferenceBuilder({int dependency, ReferenceKind kind, int unit, int numTypeParameters, String name})
|
| + @override
|
| + int get containingReference => _containingReference ??= 0;
|
| +
|
| + /**
|
| + * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
|
| + * and the entity being referred to is contained within another entity, index
|
| + * of the containing entity. This behaves similarly to
|
| + * [UnlinkedReference.prefixReference], however it is only used for class
|
| + * members, not for prefixed imports.
|
| + *
|
| + * Containing references must always point backward; that is, for all i, if
|
| + * LinkedUnit.references[i].containingReference != 0, then
|
| + * LinkedUnit.references[i].containingReference < i.
|
| + */
|
| + void set containingReference(int _value) {
|
| + assert(!_finished);
|
| + assert(_value == null || _value >= 0);
|
| + _containingReference = _value;
|
| + }
|
| +
|
| + LinkedReferenceBuilder({int dependency, ReferenceKind kind, int unit, int numTypeParameters, String name, int containingReference})
|
| : _dependency = dependency,
|
| _kind = kind,
|
| _unit = unit,
|
| _numTypeParameters = numTypeParameters,
|
| - _name = name;
|
| + _name = name,
|
| + _containingReference = containingReference;
|
|
|
| fb.Offset finish(fb.Builder fbBuilder) {
|
| assert(!_finished);
|
| @@ -1308,6 +1408,9 @@ class LinkedReferenceBuilder extends Object with _LinkedReferenceMixin implement
|
| if (offset_name != null) {
|
| fbBuilder.addOffset(4, offset_name);
|
| }
|
| + if (_containingReference != null && _containingReference != 0) {
|
| + fbBuilder.addUint32(5, _containingReference);
|
| + }
|
| return fbBuilder.endTable();
|
| }
|
| }
|
| @@ -1320,6 +1423,9 @@ abstract class LinkedReference extends base.SummaryClass {
|
| /**
|
| * Index into [LinkedLibrary.dependencies] indicating which imported library
|
| * declares the entity being referred to.
|
| + *
|
| + * Zero if this entity is contained within another entity (e.g. a class
|
| + * member).
|
| */
|
| int get dependency;
|
|
|
| @@ -1334,6 +1440,9 @@ abstract class LinkedReference extends base.SummaryClass {
|
| * definition of the entity. As with indices into [LinkedLibrary.units],
|
| * zero represents the defining compilation unit, and nonzero values
|
| * represent parts in the order of the corresponding `part` declarations.
|
| + *
|
| + * Zero if this entity is contained within another entity (e.g. a class
|
| + * member).
|
| */
|
| int get unit;
|
|
|
| @@ -1349,6 +1458,19 @@ abstract class LinkedReference extends base.SummaryClass {
|
| * string is "dynamic". For the pseudo-type `void`, the string is "void".
|
| */
|
| String get name;
|
| +
|
| + /**
|
| + * If this [LinkedReference] doesn't have an associated [UnlinkedReference],
|
| + * and the entity being referred to is contained within another entity, index
|
| + * of the containing entity. This behaves similarly to
|
| + * [UnlinkedReference.prefixReference], however it is only used for class
|
| + * members, not for prefixed imports.
|
| + *
|
| + * Containing references must always point backward; that is, for all i, if
|
| + * LinkedUnit.references[i].containingReference != 0, then
|
| + * LinkedUnit.references[i].containingReference < i.
|
| + */
|
| + int get containingReference;
|
| }
|
|
|
| class _LinkedReferenceReader extends fb.TableReader<_LinkedReferenceImpl> {
|
| @@ -1368,6 +1490,7 @@ class _LinkedReferenceImpl extends Object with _LinkedReferenceMixin implements
|
| int _unit;
|
| int _numTypeParameters;
|
| String _name;
|
| + int _containingReference;
|
|
|
| @override
|
| int get dependency {
|
| @@ -1398,6 +1521,12 @@ class _LinkedReferenceImpl extends Object with _LinkedReferenceMixin implements
|
| _name ??= const fb.StringReader().vTableGet(_bp, 4, '');
|
| return _name;
|
| }
|
| +
|
| + @override
|
| + int get containingReference {
|
| + _containingReference ??= const fb.Uint32Reader().vTableGet(_bp, 5, 0);
|
| + return _containingReference;
|
| + }
|
| }
|
|
|
| abstract class _LinkedReferenceMixin implements LinkedReference {
|
| @@ -1408,6 +1537,7 @@ abstract class _LinkedReferenceMixin implements LinkedReference {
|
| "unit": unit,
|
| "numTypeParameters": numTypeParameters,
|
| "name": name,
|
| + "containingReference": containingReference,
|
| };
|
| }
|
|
|
|
|