Skip to content

Commit

Permalink
fix overzealous id_under_loop detection
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Sep 4, 2024
1 parent 15e2efb commit 2f9752a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -820,16 +820,17 @@ const Parser = struct {
// properly (eg by only printing the id element on
// $loop.first)
if (node.idAttr()) |id| blk: {
const value = id.value orelse break :blk;
if (std.mem.startsWith(
u8,
"$",
id.name.slice(p.src),
value.span.slice(p.src),
)) break :blk;

var upper = ast.parent(node);
while (upper.kind != .root) : (upper = ast.parent(upper)) {
const attr = upper.if_loop orelse continue;
if (attr.name.len() == "if".len) break;
if (attr.name.len() == ":if".len) break;
try p.errors.append(gpa, .{
.kind = .id_under_loop,
.main_location = id.name,
Expand Down
1 change: 1 addition & 0 deletions src/wasm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ const lsp_exe = @import("cli/lsp.zig");

pub fn main() !void {
const gpa = std.heap.wasm_allocator;
std.debug.print("yep new build 2", .{});
try lsp_exe.run(gpa, &.{});
}

0 comments on commit 2f9752a

Please sign in to comment.