Skip to content

IOperation support for implicit Index/Range indexer over non-array types #58079

@AlekseyTs

Description

@AlekseyTs
    /// <summary>
    /// Represents a reference to an implicit Index or Range indexer over non-array type.
    /// <para>
    /// Current usage:
    ///  (1) C# implicit Index or Range indexer reference expression.
    /// </para>
    /// </summary>
    /// <remarks>
    /// <para>This node is associated with the following operation kinds:</para>
    /// <list type="bullet">
    /// <item><description><see cref="OperationKind.ImplicitIndexerReference"/></description></item>
    /// </list>
    /// <para>This interface is reserved for implementation by its associated APIs. We reserve the right to
    /// change it in the future.</para>
    /// </remarks>
    public interface IImplicitIndexerReferenceOperation : IOperation
    {
        /// <summary>
        /// Instance of the type to be indexed.
        /// </summary>
        IOperation Instance { get; }

        /// <summary>
        /// Index or Range value.
        /// </summary>
        IOperation Index { get; }

        /// <summary>
        /// The <c>Length</c> or <c>Count</c> property that can be used to fetch the length value.
        /// </summary>
        ISymbol LengthSymbol { get; }

        /// <summary>
        /// Symbol for the underlying indexer or a slice method that is being used to implement the implicit indexer.
        /// </summary>
        ISymbol IndexerSymbol { get; }
    }

Implicit Index/Range indexer over array types will continue to be represented as IArrayElementReferenceOperation.

See also proposal for list patterns #57194.

Metadata

Metadata

Assignees

Labels

Area-AnalyzersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.Feature - RangeRangeFeature Requestapi-approvedAPI was approved in API review, it can be implemented

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions