atproto_sdl/lower/scope

Reference resolution for lower/*: the lowering context (Ctx) and the classification of a parsed RefPath into a union alias, a named ref string, or a built-in scalar. A bare local name resolves against union aliases first, then local defs, then the scalar/format table; a dotted path is always a named cross-doc ref, with self-references normalizing to a bare #frag.

Types

pub type Ctx {
  Ctx(
    id: String,
    known_docs: set.Set(String),
    union_aliases: dict.Dict(String, #(List(tree.RefPath), Bool)),
    local_refs: dict.Dict(String, String),
  )
}

Constructors

pub type RefKind {
  RkScalar(kind: ScalarKind)
  RkNamed(ref: String)
  RkAlias(members: List(tree.RefPath), closed: Bool)
}

Constructors

pub type ScalarKind {
  SkString
  SkInteger
  SkBoolean
  SkBytes
  SkBlob
  SkCidLink
  SkUnknown
  SkFormat(format: ast.StringFormat)
}

Constructors

  • SkString
  • SkInteger
  • SkBoolean
  • SkBytes
  • SkBlob
  • SkCidLink
  • SkUnknown
  • SkFormat(format: ast.StringFormat)

Values

pub fn qualified_ref_string(
  path: tree.RefPath,
  ctx: Ctx,
) -> String

Fully qualified rendering for enum/knownValues member refs, which the lexicon spells absolute even for same-document targets (unlike ref fields, where a same-doc target stays a bare fragment).

pub fn resolve_ref(
  path: tree.RefPath,
  span: token.Span,
  ctx: Ctx,
) -> Result(RefKind, error.ParseError)
Search Document