This commit is contained in:
agra
2026-02-18 15:59:49 +02:00
parent 2f5eb84259
commit 188ffed5af
13 changed files with 414 additions and 47 deletions

View File

@@ -39,6 +39,7 @@ pub const Node = struct {
type_expr: TypeExpr,
param: Param,
defer_stmt: DeferStmt,
push_stmt: PushStmt,
comptime_expr: ComptimeExpr,
insert_expr: InsertExpr,
return_stmt: ReturnStmt,
@@ -253,12 +254,18 @@ pub const StructTypeParam = struct {
constraint: *Node, // type_expr: "u32" for value param, "Type" for type param
};
pub const UsingEntry = struct {
insert_index: u32, // position in field_names where used fields are spliced
type_name: []const u8, // struct type to inline
};
pub const StructDecl = struct {
name: []const u8,
field_names: []const []const u8,
field_types: []const *Node, // type_expr nodes
field_defaults: []const ?*Node, // default value per field, null if none
type_params: []const StructTypeParam = &.{},
using_entries: []const UsingEntry = &.{},
};
pub const StructFieldInit = struct {
@@ -288,6 +295,11 @@ pub const DeferStmt = struct {
expr: *Node,
};
pub const PushStmt = struct {
context_expr: *Node,
body: *Node,
};
pub const ComptimeExpr = struct {
expr: *Node,
};