Uses input_string.
Tries to look up the Decl component-wise but then falls back to a file path
based scan.
export fn find_decl() Decl.Index
export fn find_decl() Decl.Index {
const result = Decl.find(input_string.items);
if (result != .none) return result;
const g = struct {
var match_fqn: ArrayList(u8) = .empty;
};
for (Walk.decls.items, 0..) |*decl, decl_index| {
g.match_fqn.clearRetainingCapacity();
decl.fqn(&g.match_fqn) catch @panic("OOM");
if (std.mem.eql(u8, g.match_fqn.items, input_string.items)) {
//const path = @as(Decl.Index, @enumFromInt(decl_index)).get().file.path();
//log.debug("find_decl '{s}' found in {s}", .{ input_string.items, path });
return @fromBackingInt(@intCast(decl_index));
}
}
return .none;
}