pub struct FnDecl {
pub name: Ident,
pub type_params: Vec<TypeParam>,
pub params: Vec<Param>,
pub return_type: Option<TypeExpr>,
pub body: Block,
pub is_nogc: bool,
pub effect_annotation: Option<Vec<String>>,
pub decorators: Vec<Decorator>,
pub vis: Visibility,
}Expand description
Function declaration: fn solve(x: f64, tol: f64 = 1e-6) -> f64 { ... }
Represents a complete function definition including its signature, body, and metadata (NoGC flag, decorators, visibility).
Every new builtin must be registered in [cjc_runtime::builtins],
[cjc_eval], and [cjc_mir_exec] (the “wiring pattern”).
Fields§
§name: IdentFunction name.
type_params: Vec<TypeParam>Generic type parameters.
params: Vec<Param>Positional parameters with types, optional defaults, and variadic flag.
return_type: Option<TypeExpr>Optional return-type annotation. None means the return type is inferred.
body: BlockFunction body block.
is_nogc: boolWhether this function is marked @nogc (no GC allocations allowed).
effect_annotation: Option<Vec<String>>Effect annotation: fn foo() -> i64 / pure { ... }
None means “any effect” (backward compatible).
decorators: Vec<Decorator>Decorators applied to this function (e.g., @log, @timed).
vis: VisibilityVisibility qualifier.