Skip to content

Commit e8e542a

Browse files
committed
fix(build): remove asm_legacy references for latest Zig
1 parent 60cff3d commit e8e542a

File tree

6 files changed

+21
-78
lines changed

6 files changed

+21
-78
lines changed

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// nix flake update --commit-lock-file
1111
// ```
1212
// If you do not use Nix, a ZLS maintainer can take care of this.
13-
.minimum_zig_version = "0.16.0-dev.1484+d0ba6642b",
13+
.minimum_zig_version = "0.16.0-dev.1575+143608d85",
1414
// If you do not use Nix, a ZLS maintainer can take care of this.
1515
// Whenever the dependencies are updated, run the following command:
1616
// ```bash

src/DocumentScope.zig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
//! Stores all Scopes and Declarations/Symbols inside a Zig source file.
22

33
const std = @import("std");
4-
const ast = @import("ast.zig");
54
const Ast = std.zig.Ast;
5+
66
const tracy = @import("tracy");
7+
8+
const ast = @import("ast.zig");
79
const offsets = @import("offsets.zig");
810

911
const DocumentScope = @This();
@@ -766,7 +768,6 @@ fn walkNode(
766768
.builtin_call,
767769
.builtin_call_comma,
768770
.container_field,
769-
.asm_legacy,
770771
.asm_simple,
771772
.@"asm",
772773

src/analysis.zig

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77
//! - `lookupSymbolContainer`
88
//!
99

10-
const builtin = @import("builtin");
1110
const std = @import("std");
12-
const DocumentStore = @import("DocumentStore.zig");
1311
const Ast = std.zig.Ast;
14-
const offsets = @import("offsets.zig");
15-
const Uri = @import("Uri.zig");
16-
const log = std.log.scoped(.analysis);
17-
const ast = @import("ast.zig");
12+
const builtin = @import("builtin");
13+
1814
const tracy = @import("tracy");
19-
const InternPool = @import("analyser/InternPool.zig");
20-
const references = @import("features/references.zig");
15+
const version_data = @import("version_data");
2116

17+
const InternPool = @import("analyser/InternPool.zig");
18+
const ast = @import("ast.zig");
2219
pub const DocumentScope = @import("DocumentScope.zig");
2320
pub const Declaration = DocumentScope.Declaration;
2421
pub const Scope = DocumentScope.Scope;
22+
const DocumentStore = @import("DocumentStore.zig");
23+
const references = @import("features/references.zig");
24+
const offsets = @import("offsets.zig");
25+
const Uri = @import("Uri.zig");
2526

26-
const version_data = @import("version_data");
27-
27+
const log = std.log.scoped(.analysis);
2828
const Analyser = @This();
2929

3030
gpa: std.mem.Allocator,
@@ -2926,7 +2926,6 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, options: ResolveOptions) error
29262926
.@"resume",
29272927
=> {},
29282928

2929-
.asm_legacy,
29302929
.asm_simple,
29312930
.@"asm",
29322931
.asm_output,

src/ast.zig

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
//! when there are parser errors.
44

55
const std = @import("std");
6-
const offsets = @import("offsets.zig");
76
const Ast = std.zig.Ast;
87
const Node = Ast.Node;
98
const full = Ast.full;
109

10+
const offsets = @import("offsets.zig");
11+
1112
fn fullPtrTypeComponents(tree: *const Ast, info: full.PtrType.Components) full.PtrType {
1213
const size: std.builtin.Type.Pointer.Size = switch (tree.tokenTag(info.main_token)) {
1314
.asterisk,
@@ -691,11 +692,6 @@ pub fn lastToken(tree: *const Ast, node: Node.Index) Ast.TokenIndex {
691692
const index = @intFromEnum(extra_index) + extra.inputs + @intFromBool(extra.has_else);
692693
n = @enumFromInt(tree.extra_data[index]);
693694
},
694-
.asm_legacy => {
695-
_, const extra_index = tree.nodeData(n).node_and_extra;
696-
const extra = tree.extraData(extra_index, Node.AsmLegacy);
697-
break extra.rparen;
698-
},
699695
.@"asm" => {
700696
_, const extra_index = tree.nodeData(n).node_and_extra;
701697
const extra = tree.extraData(extra_index, Node.Asm);
@@ -1518,7 +1514,6 @@ fn iterateChildrenTypeErased(
15181514
if (field.value_expr.unwrap()) |value_expr| try callback(context, tree, value_expr);
15191515
},
15201516

1521-
.asm_legacy,
15221517
.@"asm",
15231518
=> {
15241519
const asm_node = tree.asmFull(node);

src/features/semantic_tokens.zig

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
const std = @import("std");
44
const Ast = std.zig.Ast;
55

6-
const offsets = @import("../offsets.zig");
7-
const DocumentStore = @import("../DocumentStore.zig");
6+
const types = @import("lsp").types;
7+
88
const Analyser = @import("../analysis.zig");
99
const ast = @import("../ast.zig");
10-
const types = @import("lsp").types;
10+
const DocumentStore = @import("../DocumentStore.zig");
11+
const offsets = @import("../offsets.zig");
1112

1213
pub const TokenType = enum(u32) {
1314
namespace,
@@ -737,51 +738,6 @@ fn writeNodeTokens(builder: *Builder, node: Ast.Node.Index) error{OutOfMemory}!v
737738
.unreachable_literal => {
738739
try writeToken(builder, main_token, .keywordLiteral);
739740
},
740-
.asm_legacy => {
741-
const asm_node: Ast.full.AsmLegacy = ast.asmLegacy(tree, node);
742-
743-
try writeToken(builder, main_token, .keyword);
744-
try writeToken(builder, asm_node.volatile_token, .keyword);
745-
try writeNodeTokens(builder, asm_node.ast.template);
746-
747-
for (asm_node.outputs) |output_node| {
748-
try writeToken(builder, tree.nodeMainToken(output_node), .variable);
749-
try writeToken(builder, tree.nodeMainToken(output_node) + 2, .string);
750-
const has_arrow = tree.tokenTag(tree.nodeMainToken(output_node) + 4) == .arrow;
751-
if (has_arrow) {
752-
if (tree.nodeData(output_node).opt_node_and_token[0].unwrap()) |lhs| {
753-
try writeNodeTokens(builder, lhs);
754-
}
755-
} else {
756-
try writeToken(builder, tree.nodeMainToken(output_node) + 4, .variable);
757-
}
758-
}
759-
760-
for (asm_node.inputs) |input_node| {
761-
try writeToken(builder, tree.nodeMainToken(input_node), .variable);
762-
try writeToken(builder, tree.nodeMainToken(input_node) + 2, .string);
763-
try writeNodeTokens(builder, tree.nodeData(input_node).node_and_token[0]);
764-
}
765-
766-
if (asm_node.first_clobber) |first_clobber| clobbers: {
767-
var tok_i = first_clobber;
768-
while (true) : (tok_i += 1) {
769-
try writeToken(builder, tok_i, .string);
770-
tok_i += 1;
771-
switch (tree.tokenTag(tok_i)) {
772-
.r_paren => break :clobbers,
773-
.comma => {
774-
if (tree.tokenTag(tok_i + 1) == .r_paren) {
775-
break :clobbers;
776-
} else {
777-
continue;
778-
}
779-
},
780-
else => break :clobbers,
781-
}
782-
}
783-
}
784-
},
785741
.asm_simple,
786742
.@"asm",
787743
=> {

src/print_ast.zig

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const std = @import("std");
44
const Ast = std.zig.Ast;
5+
56
const expectEqualStrings = @import("testing.zig").expectEqualStrings;
67

78
pub const RenderOptions = struct {
@@ -489,14 +490,6 @@ const PrintAst = struct {
489490
try p.renderItem(statement);
490491
}
491492
},
492-
.asm_legacy => {
493-
const asm_data = tree.asmLegacy(node);
494-
try p.renderOptTokenField(asm_data.first_clobber, "first_clobber", .hide_if_none);
495-
try p.renderOptTokenField(asm_data.volatile_token, "volatile_token", .hide_if_none);
496-
try p.renderField(asm_data.ast.template, "template");
497-
try p.renderNodeSliceField(asm_data.inputs, "inputs");
498-
try p.renderNodeSliceField(asm_data.outputs, "outputs");
499-
},
500493
.asm_simple,
501494
.@"asm",
502495
=> {
@@ -758,7 +751,6 @@ fn nodeTagName(tag: Ast.Node.Tag) []const u8 {
758751
.block,
759752
.block_semicolon,
760753
=> "Block",
761-
.asm_legacy,
762754
.asm_simple,
763755
.@"asm",
764756
=> "Asm",

0 commit comments

Comments
 (0)