DeclKind

enum DeclKind

The grammar form and children of a parsed declaration.

Nominal payloads retain names, spans, generics, constraints, and member bodies. Context-sensitive parser entry points decide whether a func, init, or property is a member; visibility and type validity are checked later.

Cases

case import_decl(Import)

A module import declaration.

case func_decl(Func)

A function declaration with a body.

case func_signature(FuncSignature)

A bodyless function requirement.

case init_decl([Parameter], Block)

An initializer's parameters and body.

case method(Func, Bool, ReceiverMode)

A function member, whether it is static, and its receiver mode.

case init_requirement(FuncSignature)

A bodyless initializer requirement.

case macro_decl(String, Int, Int, [MacroParam], Int, Int, [MacroToken])

name + its token span, parameters, template body range + canonical tokens. The body is an unparsed token template: the invocation position's category decides how it parses (ADR 0026's unified template model).

case macro_call_decl(String, Int, Int, Int, Int, [MacroToken], [Expr])

An @macro invocation in declaration position: name + its token span, the input extent, canonical tokens (outer delimiters included), and the parsed arguments when the input is a parenthesized expression list (used by the compiler-provided @assert).

case wrapper_decl(String, Int, Int, Int, Int, [MacroToken], [MacroToken], [Decl])

A #[name] / #[name(tokens)] declaration wrapper marker attached to the following declaration (ADR 0026): name + its token span, the argument extent and canonical argument tokens (outer parentheses included; empty for the bare #[name] form), the target's canonical tokens, and the parsed target declaration. The single-element array supplies the indirection the recursive payload needs; adjacent markers nest, innermost closest to the declaration.