Skip to content

Commit

Permalink
remove Type.array_index
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix authored and llogick committed Oct 5, 2023
1 parent f146a15 commit 2312eca
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
13 changes: 1 addition & 12 deletions src/analysis.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1592,9 +1592,6 @@ pub const Type = struct {
/// Branching types
either: []const EitherEntry,

// TODO: Unused?
array_index,

ip_index: struct {
node: ?Ast.Node.Index = null,
/// this stores both the type and the value
Expand Down Expand Up @@ -1631,7 +1628,6 @@ pub const TypeWithHandle = struct {
hashTypeWithHandle(hasher, e.type_with_handle);
}
},
.array_index => {},
.ip_index => |payload| {
std.hash.autoHash(hasher, payload.node);
std.hash.autoHash(hasher, payload.index);
Expand Down Expand Up @@ -1683,7 +1679,6 @@ pub const TypeWithHandle = struct {
if (!self.eql(ae.type_with_handle, be.type_with_handle)) return false;
}
},
.array_index => {},
.ip_index => |a_payload| {
const b_payload = b.type.data.ip_index;

Expand Down Expand Up @@ -1739,7 +1734,7 @@ pub const TypeWithHandle = struct {
};
}

/// Resolves possible types of a type (single for all except array_index and either)
/// Resolves possible types of a type (single for all except either)
/// Drops duplicates
pub fn getAllTypesWithHandles(ty: TypeWithHandle, arena: std.mem.Allocator) ![]const TypeWithHandle {
var all_types = std.ArrayListUnmanaged(TypeWithHandle){};
Expand Down Expand Up @@ -2540,7 +2535,6 @@ pub const Declaration = union(enum) {
node: Ast.Node.Index,
index: u32,
},
array_index: Ast.TokenIndex,
switch_payload: Switch,
label_decl: struct {
label: Ast.TokenIndex,
Expand Down Expand Up @@ -2626,7 +2620,6 @@ pub const DeclWithHandle = struct {
.error_union_payload => |ep| ep.name,
.error_union_error => |ep| ep.name,
.array_payload => |ap| ap.identifier,
.array_index => |ai| ai,
.label_decl => |ld| ld.label,
.error_token => |et| et,
.assign_destructure => |payload| {
Expand Down Expand Up @@ -2808,10 +2801,6 @@ pub const DeclWithHandle = struct {
.Single,
),
.assign_destructure => null, // TODO
.array_index => TypeWithHandle{
.type = .{ .data = .array_index, .is_type_val = false },
.handle = self.handle,
},
.label_decl => |decl| try analyser.resolveTypeOfNodeInternal(.{
.node = decl.block,
.handle = self.handle,
Expand Down
1 change: 0 additions & 1 deletion src/features/completions.zig
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ fn declToCompletion(context: DeclToCompletionContext, decl_handle: Analyser.Decl
.error_union_error,
.array_payload,
.assign_destructure,
.array_index,
.switch_payload,
.label_decl,
=> {
Expand Down
1 change: 0 additions & 1 deletion src/features/hover.zig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ pub fn hoverSymbol(
.error_union_error,
.array_payload,
.assign_destructure,
.array_index,
.switch_payload,
.label_decl,
.error_token,
Expand Down
2 changes: 1 addition & 1 deletion src/features/references.zig
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ pub fn symbolReferences(
},
.param_payload => |payload| try builder.collectReferences(curr_handle, payload.func),
.label_decl => unreachable, // handled separately by labelReferences
.array_index, .error_token => {},
.error_token => {},
}

return builder.locations;
Expand Down

0 comments on commit 2312eca

Please sign in to comment.