OxL Справочник OxL
РусскийEnglish

data Span

A source range: file path, 1-based line and column of the start, byte offset and length.

Example:

oxl✓ проверяется в CI
use std.comptime { Decl, warn }

comptime fn todo_names(d: Decl) {
  if d.name.startsWith("todo") {
    warn(d.span, "{d.name} at line {d.span.line} of {d.span.file}")
  }
}
pub(api) data Span

С версии. 1.0.0-beta

Поля

pub(api) file: str

Path of the source file.

pub(api) line: u32

1-based line of the start.

pub(api) col: u32

1-based column of the start.

pub(api) offset: u32

Byte offset of the start in the file.

pub(api) length: u32

Length in bytes.

Определено в: std/comptime/comptime.oxl:37

См. также