트랩은 검사가 쓰인 파일을 댄다
빌드 전체가 한 모듈이라 파일 이름도 하나였다. std.list 안에서 터진 경계 검사가 프로그램의 파일 이름을 대고 있었으니, 줄 번호는 맞는데 파일이 틀려서 엉뚱한 줄을 가리켰다 -- 이름을 안 대는 것보다 나쁘다. 모듈이 파일 표를 들고 트랩은 그 인덱스를 든다. 생성기는 파일마다 FE_FILE_n 을 한 번씩 찍는다. before: index out of bounds at main.fe:2 after: index out of bounds at pick.fe:6 그리고 Parser.on 이 구조체 리터럴 안에서 다시 try 를 쓴다. 앞서 그것이 깨졌던 것은 try 때문이 아니라 Parser 가 1 바이트로 자리잡았기 때문이었다. 224/224, 31/31.
This commit is contained in:
@@ -23,10 +23,8 @@ pub struct Parser {
|
||||
pub errors: usize,
|
||||
|
||||
pub fn on(src: []u8) -> !Self {
|
||||
let nodes: list.List(ast.Node) =
|
||||
try list.List(ast.Node).with_capacity(16);
|
||||
var p: Self = Self{
|
||||
nodes: nodes,
|
||||
nodes: try list.List(ast.Node).with_capacity(16),
|
||||
at: 0,
|
||||
line: 1,
|
||||
cur: tok.Token{ kind: tok.Kind.End, from: 0, len: 0, line: 1 },
|
||||
|
||||
Reference in New Issue
Block a user