Better import handling

This commit is contained in:
Alexandros Naskos
2021-03-30 15:41:59 +03:00
parent afc6d1fd1f
commit f382a1b22d
4 changed files with 47 additions and 31 deletions

View File

@@ -1191,7 +1191,7 @@ pub fn collectImports(import_arr: *std.ArrayList([]const u8), tree: ast.Tree) !v
if (tags[i] != .builtin)
continue;
const text = tree.tokenSlice(@intCast(u32, i));
if (std.mem.eql(u8, text, "@import")) {
if (i + 3 >= tags.len)
break;
@@ -1202,9 +1202,8 @@ pub fn collectImports(import_arr: *std.ArrayList([]const u8), tree: ast.Tree) !v
if (tags[i + 3] != .r_paren)
continue;
const str = tree.tokenSlice(@intCast(u32, i + 2));
try import_arr.append(str[1..str.len-1]);
try import_arr.append(str[1 .. str.len - 1]);
}
}
}