stage2 修复大量AI生成的风格问题 stage1 修复对于vm abi的错误生成
This commit is contained in:
1 parent
0e38858785
commit
76f980654c
40 files changed
+619
-938
No files matched your search
+4
-12
@@ -1,12 +1,7 @@
|
||||
// Expect retcode = 0
|
||||
|
||||
// 声明句柄表(移植自 stage1/spl_lang_type.h 的 spl_def_node_t 部分)。
|
||||
// DefId 是「声明」的稳定身份:作用域符号、AST 节点 resolved_def_id、以及将来
|
||||
// comptime 生成的声明都用它。前向引用/环形引用由 state 状态机表达。
|
||||
//
|
||||
// 与 stage1 的差异:owner_ast 改为不透明 `*any`(借用),使本表不依赖具体 AST
|
||||
// 表示,便于将来 comptime/序列化复用;sema 侧自行 cast 回 *Ast。
|
||||
// 名称是 ByteView(借用源/AST),本表不做拥有。
|
||||
// 声明句柄表。DefId 是声明的稳定身份:作用域符号、节点 resolved_def_id、comptime
|
||||
// 生成的声明都用它;前向/环形引用由 state 状态机表达。owner_ast 为不透明 *any。
|
||||
|
||||
type .{ .Error } = @import("utils/error.spl");
|
||||
type .{ .Vec } = @import("utils/vec.spl");
|
||||
@@ -84,7 +79,7 @@ fn drop(self: *DefTable) {
|
||||
Vec.drop(&self.table);
|
||||
}
|
||||
|
||||
// id 0 与越界均返回 null(对应 stage1 spl_def_node)。
|
||||
// id 0 与越界均返回 null。
|
||||
fn node(self: *DefTable, id: usize): *DefNode {
|
||||
if id == 0 || id >= self.table.len { ret null; }
|
||||
ret (self.table.data as *DefNode) + id;
|
||||
@@ -129,7 +124,6 @@ fn get_lang_id(self: *DefTable, id: usize): usize {
|
||||
ret d.lang_id;
|
||||
}
|
||||
|
||||
// ---- 分类 ----
|
||||
|
||||
fn kind_name(kind: DefKind): []u8 {
|
||||
match kind {
|
||||
@@ -156,7 +150,7 @@ fn state_name(state: DeclState): []u8 {
|
||||
ret "unknown";
|
||||
}
|
||||
|
||||
// 能作为类型使用的 def(对应 stage1 sema_def_is_type)。
|
||||
// 能作为类型使用的 def。
|
||||
fn is_type_kind(kind: DefKind): bool {
|
||||
match kind {
|
||||
.Scalar => { ret true; },
|
||||
@@ -169,7 +163,6 @@ fn is_type_kind(kind: DefKind): bool {
|
||||
ret false;
|
||||
}
|
||||
|
||||
// ---- dump(镜像 stage1 spl_type_def_dump 的文本)----
|
||||
|
||||
fn push_out(buf: *ByteBuffer, bytes: []u8): bool {
|
||||
match ByteBuffer.append(buf, bytes) {
|
||||
@@ -203,7 +196,6 @@ fn dump(self: *DefTable, id: usize, out: *ByteBuffer): bool {
|
||||
ret push_out(out, ByteView.as_slice(d.name));
|
||||
}
|
||||
|
||||
// ---- 测试 ----
|
||||
|
||||
fn test_alloc_and_state() {
|
||||
var dt: DefTable = undefined;
|
||||
|
||||
Reference in new issue
Block a user