05
This commit is contained in:
@@ -200,6 +200,10 @@ pub const Op = union(enum) {
|
||||
box_any: BoxAny, // T → Any (erase type)
|
||||
unbox_any: UnaryOp, // Any → T (restore type)
|
||||
|
||||
// ── Reflection ─────────────────────────────────────────────────
|
||||
field_name_get: FieldReflect, // field_name(T, i) → string (runtime index)
|
||||
field_value_get: FieldReflect, // field_value(s, i) → Any (runtime struct + index)
|
||||
|
||||
// ── Terminators ─────────────────────────────────────────────────
|
||||
br: Branch,
|
||||
cond_br: CondBranch,
|
||||
@@ -277,7 +281,6 @@ pub const BuiltinCall = struct {
|
||||
};
|
||||
|
||||
pub const BuiltinId = enum(u16) {
|
||||
print,
|
||||
out,
|
||||
sqrt,
|
||||
size_of,
|
||||
@@ -286,6 +289,9 @@ pub const BuiltinId = enum(u16) {
|
||||
free,
|
||||
memcpy,
|
||||
memset,
|
||||
type_of,
|
||||
alloc,
|
||||
dealloc,
|
||||
};
|
||||
|
||||
pub const ProtocolCall = struct {
|
||||
@@ -324,6 +330,12 @@ pub const BoxAny = struct {
|
||||
source_type: TypeId,
|
||||
};
|
||||
|
||||
pub const FieldReflect = struct {
|
||||
base: Ref, // struct value (for field_value_get) or Ref.none (for field_name_get)
|
||||
index: Ref, // runtime field index
|
||||
struct_type: TypeId, // compile-time resolved struct type
|
||||
};
|
||||
|
||||
pub const Branch = struct {
|
||||
target: BlockId,
|
||||
args: []const Ref, // block param values
|
||||
@@ -356,6 +368,7 @@ pub const Block = struct {
|
||||
name: StringId,
|
||||
params: []const TypeId, // block parameter types (SSA phi alternative)
|
||||
insts: std.ArrayList(Inst),
|
||||
first_ref: u32 = 0, // ref index of the first instruction in this block
|
||||
|
||||
pub fn init(name: StringId, params: []const TypeId) Block {
|
||||
return .{
|
||||
|
||||
Reference in New Issue
Block a user