Class CompletionArrayArgument
- Namespace
- RDCore.SDK.Model.Symbols.Completion
- Assembly
- RDCore.SDK.dll
An argument that is given an array: what a name written there must be declared as for a completion list to offer it, and where it ranks.
public sealed record CompletionArrayArgument : IEquatable<CompletionArrayArgument>
- Inheritance
-
CompletionArrayArgument
- Implements
- Inherited Members
Remarks
An argument is given an array in two cases:
- the first argument of
LBoundandUBound, special forms (MS-VBAL §3.3.5.2) whose operand is an array, or aVariantthat may hold one when it runs: one declared as a scalar, anObject, a class or a user-defined type is "Expected array", and so is a project, a module or anEnum; - an argument of a parameter declared as an array, which is passed by reference, named or not: the declared type of its argument must
match the parameter's (MS-VBAL §5.3.1.11), so a
Variantis not accepted there. The element types match as MS-VBA and RDCore's compiler match them, which is not always the specification's letter.
How the element types of an array argument match:
- a
String * 3does not match aString: a fixed-lengthStringis a declared type of its own, as the specification has it; - an array of any
Enummatches a parameter declared as an array of anEnum, and an array ofLongdoes not, nor the reverse, though by the specification's letter a declaration that uses anEnumhas the declared typeLong(MS-VBAL §2.2, §5.2.3.4); - a fixed-size array is accepted as a resizable one is, though by the specification's letter it is of another declared type.
A variable, a field (of a user-defined type too), a parameter, a Function and a Property are offered by their declared type: a
Function or a Property Get by the type it returns (UBound(Titles())). A constant, an Enum member and a Sub never are, nor
is a keyword or a name with no declared type.
What is offered ranks in four tiers (GroupsOf(IEnumerable<CompletionCandidate>, ISymbolResolver?)): the arrays the procedure declares, its own array parameters included; then the other
arrays, of its module, of the project, and the members that return one; then the Variants, for LBound and UBound; then the records
and the objects whose member is an array the argument can be given, or leads to one through its own members, three members at most in all
(UBound(o.Inner.Slots) is two, UBound(cb.C.D.Arr) three). Such a record or object is offered so that its member can be written after it;
a record or an object that leads to no such array is not offered.
Constructors
CompletionArrayArgument(VBType?)
An argument that is given an array: what a name written there must be declared as for a completion list to offer it, and where it ranks.
public CompletionArrayArgument(VBType? ItemType = null)
Parameters
ItemTypeVBTypeThe element type of the array the argument is given, for a parameter declared as an array; null when any array, or a
Variant, is given (LBound,UBound).
Remarks
An argument is given an array in two cases:
- the first argument of
LBoundandUBound, special forms (MS-VBAL §3.3.5.2) whose operand is an array, or aVariantthat may hold one when it runs: one declared as a scalar, anObject, a class or a user-defined type is "Expected array", and so is a project, a module or anEnum; - an argument of a parameter declared as an array, which is passed by reference, named or not: the declared type of its argument must
match the parameter's (MS-VBAL §5.3.1.11), so a
Variantis not accepted there. The element types match as MS-VBA and RDCore's compiler match them, which is not always the specification's letter.
How the element types of an array argument match:
- a
String * 3does not match aString: a fixed-lengthStringis a declared type of its own, as the specification has it; - an array of any
Enummatches a parameter declared as an array of anEnum, and an array ofLongdoes not, nor the reverse, though by the specification's letter a declaration that uses anEnumhas the declared typeLong(MS-VBAL §2.2, §5.2.3.4); - a fixed-size array is accepted as a resizable one is, though by the specification's letter it is of another declared type.
A variable, a field (of a user-defined type too), a parameter, a Function and a Property are offered by their declared type: a
Function or a Property Get by the type it returns (UBound(Titles())). A constant, an Enum member and a Sub never are, nor
is a keyword or a name with no declared type.
What is offered ranks in four tiers (GroupsOf(IEnumerable<CompletionCandidate>, ISymbolResolver?)): the arrays the procedure declares, its own array parameters included; then the other
arrays, of its module, of the project, and the members that return one; then the Variants, for LBound and UBound; then the records
and the objects whose member is an array the argument can be given, or leads to one through its own members, three members at most in all
(UBound(o.Inner.Slots) is two, UBound(cb.C.D.Arr) three). Such a record or object is offered so that its member can be written after it;
a record or an object that leads to no such array is not offered.
Properties
ItemType
The element type of the array the argument is given, for a parameter declared as an array; null when any array, or a Variant,
is given (LBound, UBound).
public VBType? ItemType { get; init; }
Property Value
Methods
GroupsOf(IEnumerable<CompletionCandidate>, ISymbolResolver?)
The candidates that can be given to the argument, or lead to what can be, in the tiers they rank in, each by name: the local arrays, the other arrays,
the Variants, and the records and objects that lead to an array. A candidate that is none of them is left out.
public IReadOnlyList<CompletionGroup> GroupsOf(IEnumerable<CompletionCandidate> candidates, ISymbolResolver? resolver)
Parameters
candidatesIEnumerable<CompletionCandidate>The names a completion list would offer.
resolverISymbolResolverThe resolver names are bound by, which a class or a user-defined type of the workspace is read from as the composition has it now (CurrentTypes); null when there is none.
Returns
- IReadOnlyList<CompletionGroup>
The four tiers, in the order they rank, for ListOf(string, IReadOnlyList<CompletionGroup>, IReadOnlyList<CompletionCandidate>, Position?, string?).
Of(SignatureSite, SignatureParameter?, string)
The argument at the cursor, when it is given an array and nothing of its value is written but written; null for any
other argument, or when more is written of it.
public static CompletionArrayArgument? Of(SignatureSite site, SignatureParameter? parameter, string written)
Parameters
siteSignatureSiteThe call being written.
parameterSignatureParameterThe parameter the argument is given to, when what is called is a procedure; null otherwise.
writtenstringWhat is written of the argument's value up to the cursor: the word typed, or a qualifier, its
.and the word typed after it.