Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// nix flake update --commit-lock-file
// ```
// If you do not use Nix, a ZLS maintainer can take care of this.
.minimum_zig_version = "0.16.0-dev.1484+d0ba6642b",
.minimum_zig_version = "0.16.0-dev.1575+143608d85",
// If you do not use Nix, a ZLS maintainer can take care of this.
// Whenever the dependencies are updated, run the following command:
// ```bash
Expand Down
5 changes: 3 additions & 2 deletions src/DocumentScope.zig
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//! Stores all Scopes and Declarations/Symbols inside a Zig source file.

const std = @import("std");
const ast = @import("ast.zig");
const Ast = std.zig.Ast;

const tracy = @import("tracy");

const ast = @import("ast.zig");
const offsets = @import("offsets.zig");

const DocumentScope = @This();
Expand Down Expand Up @@ -766,7 +768,6 @@ fn walkNode(
.builtin_call,
.builtin_call_comma,
.container_field,
.asm_legacy,
.asm_simple,
.@"asm",

Expand Down
21 changes: 10 additions & 11 deletions src/analysis.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
//! - `lookupSymbolContainer`
//!

const builtin = @import("builtin");
const std = @import("std");
const DocumentStore = @import("DocumentStore.zig");
const Ast = std.zig.Ast;
const offsets = @import("offsets.zig");
const Uri = @import("Uri.zig");
const log = std.log.scoped(.analysis);
const ast = @import("ast.zig");
const builtin = @import("builtin");

const tracy = @import("tracy");
const InternPool = @import("analyser/InternPool.zig");
const references = @import("features/references.zig");
const version_data = @import("version_data");

const InternPool = @import("analyser/InternPool.zig");
const ast = @import("ast.zig");
pub const DocumentScope = @import("DocumentScope.zig");
pub const Declaration = DocumentScope.Declaration;
pub const Scope = DocumentScope.Scope;
const DocumentStore = @import("DocumentStore.zig");
const references = @import("features/references.zig");
const offsets = @import("offsets.zig");
const Uri = @import("Uri.zig");

const version_data = @import("version_data");

const log = std.log.scoped(.analysis);
const Analyser = @This();

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

.asm_legacy,
.asm_simple,
.@"asm",
.asm_output,
Expand Down
9 changes: 2 additions & 7 deletions src/ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
//! when there are parser errors.

const std = @import("std");
const offsets = @import("offsets.zig");
const Ast = std.zig.Ast;
const Node = Ast.Node;
const full = Ast.full;

const offsets = @import("offsets.zig");

fn fullPtrTypeComponents(tree: *const Ast, info: full.PtrType.Components) full.PtrType {
const size: std.builtin.Type.Pointer.Size = switch (tree.tokenTag(info.main_token)) {
.asterisk,
Expand Down Expand Up @@ -691,11 +692,6 @@ pub fn lastToken(tree: *const Ast, node: Node.Index) Ast.TokenIndex {
const index = @intFromEnum(extra_index) + extra.inputs + @intFromBool(extra.has_else);
n = @enumFromInt(tree.extra_data[index]);
},
.asm_legacy => {
_, const extra_index = tree.nodeData(n).node_and_extra;
const extra = tree.extraData(extra_index, Node.AsmLegacy);
break extra.rparen;
},
.@"asm" => {
_, const extra_index = tree.nodeData(n).node_and_extra;
const extra = tree.extraData(extra_index, Node.Asm);
Expand Down Expand Up @@ -1518,7 +1514,6 @@ fn iterateChildrenTypeErased(
if (field.value_expr.unwrap()) |value_expr| try callback(context, tree, value_expr);
},

.asm_legacy,
.@"asm",
=> {
const asm_node = tree.asmFull(node);
Expand Down
52 changes: 4 additions & 48 deletions src/features/semantic_tokens.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
const std = @import("std");
const Ast = std.zig.Ast;

const offsets = @import("../offsets.zig");
const DocumentStore = @import("../DocumentStore.zig");
const types = @import("lsp").types;

const Analyser = @import("../analysis.zig");
const ast = @import("../ast.zig");
const types = @import("lsp").types;
const DocumentStore = @import("../DocumentStore.zig");
const offsets = @import("../offsets.zig");

pub const TokenType = enum(u32) {
namespace,
Expand Down Expand Up @@ -737,51 +738,6 @@ fn writeNodeTokens(builder: *Builder, node: Ast.Node.Index) error{OutOfMemory}!v
.unreachable_literal => {
try writeToken(builder, main_token, .keywordLiteral);
},
.asm_legacy => {
const asm_node: Ast.full.AsmLegacy = ast.asmLegacy(tree, node);

try writeToken(builder, main_token, .keyword);
try writeToken(builder, asm_node.volatile_token, .keyword);
try writeNodeTokens(builder, asm_node.ast.template);

for (asm_node.outputs) |output_node| {
try writeToken(builder, tree.nodeMainToken(output_node), .variable);
try writeToken(builder, tree.nodeMainToken(output_node) + 2, .string);
const has_arrow = tree.tokenTag(tree.nodeMainToken(output_node) + 4) == .arrow;
if (has_arrow) {
if (tree.nodeData(output_node).opt_node_and_token[0].unwrap()) |lhs| {
try writeNodeTokens(builder, lhs);
}
} else {
try writeToken(builder, tree.nodeMainToken(output_node) + 4, .variable);
}
}

for (asm_node.inputs) |input_node| {
try writeToken(builder, tree.nodeMainToken(input_node), .variable);
try writeToken(builder, tree.nodeMainToken(input_node) + 2, .string);
try writeNodeTokens(builder, tree.nodeData(input_node).node_and_token[0]);
}

if (asm_node.first_clobber) |first_clobber| clobbers: {
var tok_i = first_clobber;
while (true) : (tok_i += 1) {
try writeToken(builder, tok_i, .string);
tok_i += 1;
switch (tree.tokenTag(tok_i)) {
.r_paren => break :clobbers,
.comma => {
if (tree.tokenTag(tok_i + 1) == .r_paren) {
break :clobbers;
} else {
continue;
}
},
else => break :clobbers,
}
}
}
},
.asm_simple,
.@"asm",
=> {
Expand Down
10 changes: 1 addition & 9 deletions src/print_ast.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const std = @import("std");
const Ast = std.zig.Ast;

const expectEqualStrings = @import("testing.zig").expectEqualStrings;

pub const RenderOptions = struct {
Expand Down Expand Up @@ -489,14 +490,6 @@ const PrintAst = struct {
try p.renderItem(statement);
}
},
.asm_legacy => {
const asm_data = tree.asmLegacy(node);
try p.renderOptTokenField(asm_data.first_clobber, "first_clobber", .hide_if_none);
try p.renderOptTokenField(asm_data.volatile_token, "volatile_token", .hide_if_none);
try p.renderField(asm_data.ast.template, "template");
try p.renderNodeSliceField(asm_data.inputs, "inputs");
try p.renderNodeSliceField(asm_data.outputs, "outputs");
},
.asm_simple,
.@"asm",
=> {
Expand Down Expand Up @@ -758,7 +751,6 @@ fn nodeTagName(tag: Ast.Node.Tag) []const u8 {
.block,
.block_semicolon,
=> "Block",
.asm_legacy,
.asm_simple,
.@"asm",
=> "Asm",
Expand Down
Loading