stage2 ai重构

This commit is contained in:
zzy committed 2026-10-26 12:51:32 +08:00
1 parent 4c0317fcb5
commit 2c531f23de
26 files changed
+1251 -1578

No files matched your search

+5 -16
View File
@@ -7,7 +7,7 @@ type .{ .Error } = @import("utils/error.spl");
type .{ .Vec } = @import("utils/vec.spl");
type .{ .ByteView } = @import("utils/byte_view.spl");
type .{ .ByteBuffer } = @import("utils/byte_buffer.spl");
type .{ .append_usize } = @import("utils/fmt.spl");
type .{ .append_bytes_ok, .append_byte_ok, .append_usize_ok } = @import("utils/fmt.spl");
type .{ .Punct } = @import("token.spl");
type BigInt = @import("utils/mp.spl");
type .{ .Span, .span_none, .span_make, .span_is_none } = @import("./diag.spl");
@@ -107,6 +107,7 @@ type Body = enum {
has_len: bool,
len: isize,
is_underscore_len: bool,
len_expr: usize, // 编译期长度表达式 AST(0 = 无,使用字面量 len)
elem_type: usize,
},
TypeSlice: struct { elem_type: usize },
@@ -332,27 +333,15 @@ fn ref_vec(): Vec {
// indent:栈上每层 last 为真输出 " ",否则 "| "。
fn push(buf: *ByteBuffer, bytes: []u8): bool {
match ByteBuffer.append(buf, bytes) {
.Ok => { ret true; },
.Err(error) => { ret false; },
}
ret false;
ret append_bytes_ok(buf, bytes);
}
fn push_byte(buf: *ByteBuffer, byte: u8): bool {
match ByteBuffer.append_byte(buf, byte) {
.Ok => { ret true; },
.Err(error) => { ret false; },
}
ret false;
ret append_byte_ok(buf, byte);
}
fn push_usize(buf: *ByteBuffer, value: usize): bool {
match append_usize(buf, value, 10, false) {
.Ok => { ret true; },
.Err(error) => { ret false; },
}
ret false;
ret append_usize_ok(buf, value);
}
fn ref_at(list: Vec, index: usize): usize {