fix ai修复出现的stage2和stage3问题

This commit is contained in:
zzy committed 2026-11-13 22:15:07 +08:00
1 parent 50ee126d44
commit 936a8d0e88
19 files changed
+667 -679

No files matched your search

+22 -3
View File
@@ -16,7 +16,6 @@ type ErrorCode = enum {
ShapeParamNotShape,
MacroCode,
FmtMissingArg,
FmtNonliteral,
FmtBadType,
HookNotMacro,
ParamHook,
@@ -36,6 +35,14 @@ type ErrorCode = enum {
DuplicateSuccess,
TryNoError,
LambdaCapture,
// 值/声明/导入/控制流诊断;编号与 label() 固定在这里,增删只改本表。
NotAssignable,
AssignToConst,
MissingDeclType,
ImportFailed,
BreakOutsideLoop,
ContinueOutsideLoop,
VarargsNotAllowed,
};
fn number(code: ErrorCode): usize {
@@ -56,7 +63,6 @@ fn number(code: ErrorCode): usize {
.ShapeParamNotShape => { ret 308; },
.MacroCode => { ret 309; },
.FmtMissingArg => { ret 310; },
.FmtNonliteral => { ret 311; },
.FmtBadType => { ret 312; },
.HookNotMacro => { ret 313; },
.ParamHook => { ret 314; },
@@ -76,6 +82,13 @@ fn number(code: ErrorCode): usize {
.DuplicateSuccess => { ret 707; },
.TryNoError => { ret 708; },
.LambdaCapture => { ret 801; },
.NotAssignable => { ret 108; },
.AssignToConst => { ret 109; },
.MissingDeclType => { ret 110; },
.ImportFailed => { ret 111; },
.BreakOutsideLoop => { ret 323; },
.ContinueOutsideLoop => { ret 324; },
.VarargsNotAllowed => { ret 325; },
}
ret 0;
}
@@ -98,7 +111,6 @@ fn label(code: ErrorCode): []u8 {
.ShapeParamNotShape => { ret "E0308"; },
.MacroCode => { ret "E0309"; },
.FmtMissingArg => { ret "E0310"; },
.FmtNonliteral => { ret "E0311"; },
.FmtBadType => { ret "E0312"; },
.HookNotMacro => { ret "E0313"; },
.ParamHook => { ret "E0314"; },
@@ -118,6 +130,13 @@ fn label(code: ErrorCode): []u8 {
.DuplicateSuccess => { ret "E0707"; },
.TryNoError => { ret "E0708"; },
.LambdaCapture => { ret "E0801"; },
.NotAssignable => { ret "E0108"; },
.AssignToConst => { ret "E0109"; },
.MissingDeclType => { ret "E0110"; },
.ImportFailed => { ret "E0111"; },
.BreakOutsideLoop => { ret "E0323"; },
.ContinueOutsideLoop => { ret "E0324"; },
.VarargsNotAllowed => { ret "E0325"; },
}
ret "";
}
+3 -2
View File
@@ -48,6 +48,7 @@ type Node = struct {
LessEqual,
GreaterThan,
GreaterEqual,
Reserved,
}
type Agg = enum {
@@ -79,7 +80,7 @@ type Node = struct {
FieldDecl: struct { name: []u8, ty: Ref },
VarDecl: struct { is_comptime: bool, name: []u8, ty: Ref, init: Ref },
ConstDecl: struct { is_comptime: bool, name: []u8, ty: Ref, init: Ref },
Alloc: struct { ty: Ref, value: Ref },
Alloc: struct { ty: Ref, value: Ref, is_const: bool },
Block: struct { stmts: []Ref, tail: Ref },
If: struct { cond: Ref, then: Ref, els: Ref, ret_ty: Ref },
@@ -109,7 +110,7 @@ type Node = struct {
PatList: []Ref,
PatTuple: []Ref,
PatField: struct { name: []u8, sub: Ref },
PatFields: []Ref,
AggType: struct { kind: Agg, conforms: []Ref, fields: []Ref, decls: []Ref, injected: []Ref },
ArrayType: struct { len: Ref, elem: Ref },
SliceType: Ref,