@eagleoutice/flowr - v2.15.8
    Preparing search index...

    Class SourceLocationView

    An object-oriented read-only view on a SourceLocation (and hence on a SourceRange).

    The view holds a reference to the tuple it was created from and copies nothing, so it costs one small object and every accessor is a plain tuple read. Serializing it yields the very tuple again, so a view may be handed to JSON.stringify in place of the location.

    Tuples remain the representation that is stored and sent over the wire; create a view where you read a location and drop it afterwards rather than keeping one per node.

    const loc = SourceLocation.at(node);
    console.log(loc?.startLine, loc?.file, loc?.toString());
    Index
    • Parameters

      • loc: [
            startLine: number,
            startColumn: number,
            endLine: number,
            endColumn: number,
            f?: string,
        ]

      Returns SourceLocationView

    raw: [
        startLine: number,
        startColumn: number,
        endLine: number,
        endColumn: number,
        f?: string,
    ]

    The underlying tuple; use it whenever you need the plain representation back.

    • get endColumn(): number

      inclusive column the location ends at

      Returns number

    • get endLine(): number

      inclusive line the location ends on

      Returns number

    • get startColumn(): number

      inclusive column the location starts at (starts with 1)

      Returns number

    • get startLine(): number

      inclusive line the location starts on (starts with 1)

      Returns number

    • Destructuring a view yields the same elements as destructuring the tuple.

      Returns IterableIterator<string | number | undefined>

    • Whether the given position lies within this location; omitting the column checks the line alone.

      Parameters

      • line: number
      • Optionalcolumn: number

      Returns boolean

    • Serializes to the underlying tuple, so a view is interchangeable with a location in JSON output.

      Returns [
          startLine: number,
          startColumn: number,
          endLine: number,
          endColumn: number,
          f?: string,
      ]