Vixen
02b45cc4
csharp
public sealed class ArrayTypeSymbol

An array type: T[4], T[], T[,], T[][].

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A sized array and an unsized one are different types: float[4] is not float[], and neither converts to the other. That is not pedantry — the length is part of the memory layout every backend needs, so a type that has one and a type that does not cannot share a representation.

Only rank 1 can be sized. A multi-dimensional array is unsized because neither target has one: GLSL and SPIR-V both spell T[a][b] as an array of arrays, which is what two rank specifiers already build.

Fields and properties (8)

  • public TypeSymbol ElementType
  • public int Rank

    Number of dimensions; T[,] has rank 2.

  • public int? Length

    The element count, or null when the array is unsized.

  • public override SymbolKind Kind
  • public override TypeKind TypeKind
  • public override string Name
  • public override Symbol? ContainingSymbol
  • public override ResourceKind ResourceKind

    The element's, because an array of resources is a resource — one binding with a count.

Methods (6)

  • public ArrayTypeSymbol(TypeSymbol elementType, int rank = 1, int? length = null)
  • public override IReadOnlyList<Symbol> GetMembers()

    Arrays expose Length; indexing is handled by the binder. On a sized array the member is a compile-time constant, so xs.Length folds and can size another array.

  • public override string ToDisplayString()
  • public bool Equals(ArrayTypeSymbol? other)
  • public override bool Equals(object? obj)
  • public override int GetHashCode()

Used by (8)

  • BinderVixen.Raven
  • BuilderVixen.Raven
  • LowererVixen.Raven
  • MetadataLoaderVixen.Raven
  • MonomorphiserVixen.Raven
  • SizedArrayTestsVixen.Raven.Tests
  • TypeMapVixen.Raven
  • TypeSystemTestsVixen.Raven.Tests