fix comment in references.zig, format
This commit is contained in:
parent
5302cfbdbc
commit
489378b939
@ -687,9 +687,6 @@ pub fn resolveTypeOfNodeInternal(
|
|||||||
else => null,
|
else => null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// .InfixOp => {
|
|
||||||
// const infix_op = node.castTag(.InfixOp).?;
|
|
||||||
// switch (infix_op.op) {
|
|
||||||
.Period => {
|
.Period => {
|
||||||
const infix_op = node.cast(ast.Node.SimpleInfixOp).?;
|
const infix_op = node.cast(ast.Node.SimpleInfixOp).?;
|
||||||
const rhs_str = nodeToString(handle.tree, infix_op.rhs) orelse return null;
|
const rhs_str = nodeToString(handle.tree, infix_op.rhs) orelse return null;
|
||||||
@ -736,12 +733,6 @@ pub fn resolveTypeOfNodeInternal(
|
|||||||
return try resolveUnwrapErrorType(store, arena, left_type, bound_type_params);
|
return try resolveUnwrapErrorType(store, arena, left_type, bound_type_params);
|
||||||
},
|
},
|
||||||
.ErrorUnion => return TypeWithHandle.typeVal(node_handle),
|
.ErrorUnion => return TypeWithHandle.typeVal(node_handle),
|
||||||
// else => return null,
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// .PrefixOp => {
|
|
||||||
// const prefix_op = node.castTag(.PrefixOp).?;
|
|
||||||
// switch (prefix_op.op) {
|
|
||||||
.SliceType,
|
.SliceType,
|
||||||
.ArrayType,
|
.ArrayType,
|
||||||
.OptionalType,
|
.OptionalType,
|
||||||
@ -755,9 +746,6 @@ pub fn resolveTypeOfNodeInternal(
|
|||||||
}, bound_type_params)) orelse return null;
|
}, bound_type_params)) orelse return null;
|
||||||
return try resolveUnwrapErrorType(store, arena, rhs_type, bound_type_params);
|
return try resolveUnwrapErrorType(store, arena, rhs_type, bound_type_params);
|
||||||
},
|
},
|
||||||
// else => {},
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
.BuiltinCall => {
|
.BuiltinCall => {
|
||||||
const builtin_call = node.castTag(.BuiltinCall).?;
|
const builtin_call = node.castTag(.BuiltinCall).?;
|
||||||
const call_name = handle.tree.tokenSlice(builtin_call.builtin_token);
|
const call_name = handle.tree.tokenSlice(builtin_call.builtin_token);
|
||||||
@ -1349,61 +1337,7 @@ pub fn documentPositionContext(arena: *std.heap.ArenaAllocator, document: types.
|
|||||||
|
|
||||||
fn addOutlineNodes(allocator: *std.mem.Allocator, tree: *ast.Tree, child: *ast.Node, context: *GetDocumentSymbolsContext) anyerror!void {
|
fn addOutlineNodes(allocator: *std.mem.Allocator, tree: *ast.Tree, child: *ast.Node, context: *GetDocumentSymbolsContext) anyerror!void {
|
||||||
switch (child.tag) {
|
switch (child.tag) {
|
||||||
.StringLiteral, .IntegerLiteral, .BuiltinCall, .Call, .Identifier, .Add,
|
.StringLiteral, .IntegerLiteral, .BuiltinCall, .Call, .Identifier, .Add, .AddWrap, .ArrayCat, .ArrayMult, .Assign, .AssignBitAnd, .AssignBitOr, .AssignBitShiftLeft, .AssignBitShiftRight, .AssignBitXor, .AssignDiv, .AssignSub, .AssignSubWrap, .AssignMod, .AssignAdd, .AssignAddWrap, .AssignMul, .AssignMulWrap, .BangEqual, .BitAnd, .BitOr, .BitShiftLeft, .BitShiftRight, .BitXor, .BoolAnd, .BoolOr, .Div, .EqualEqual, .ErrorUnion, .GreaterOrEqual, .GreaterThan, .LessOrEqual, .LessThan, .MergeErrorSets, .Mod, .Mul, .MulWrap, .Period, .Range, .Sub, .SubWrap, .UnwrapOptional, .AddressOf, .Await, .BitNot, .BoolNot, .OptionalType, .Negation, .NegationWrap, .Resume, .Try, .ArrayType, .ArrayTypeSentinel, .PtrType, .SliceType, .SuffixOp, .ControlFlowExpression, .ArrayInitializerDot, .SwitchElse, .SwitchCase, .For, .EnumLiteral, .PointerIndexPayload, .StructInitializerDot, .PointerPayload, .While, .Switch, .Else, .BoolLiteral, .NullLiteral, .Defer, .StructInitializer, .FieldInitializer, .If, .MultilineStringLiteral, .UndefinedLiteral, .AnyType, .Block, .ErrorSetDecl => return,
|
||||||
.AddWrap,
|
|
||||||
.ArrayCat,
|
|
||||||
.ArrayMult,
|
|
||||||
.Assign,
|
|
||||||
.AssignBitAnd,
|
|
||||||
.AssignBitOr,
|
|
||||||
.AssignBitShiftLeft,
|
|
||||||
.AssignBitShiftRight,
|
|
||||||
.AssignBitXor,
|
|
||||||
.AssignDiv,
|
|
||||||
.AssignSub,
|
|
||||||
.AssignSubWrap,
|
|
||||||
.AssignMod,
|
|
||||||
.AssignAdd,
|
|
||||||
.AssignAddWrap,
|
|
||||||
.AssignMul,
|
|
||||||
.AssignMulWrap,
|
|
||||||
.BangEqual,
|
|
||||||
.BitAnd,
|
|
||||||
.BitOr,
|
|
||||||
.BitShiftLeft,
|
|
||||||
.BitShiftRight,
|
|
||||||
.BitXor,
|
|
||||||
.BoolAnd,
|
|
||||||
.BoolOr,
|
|
||||||
.Div,
|
|
||||||
.EqualEqual,
|
|
||||||
.ErrorUnion,
|
|
||||||
.GreaterOrEqual,
|
|
||||||
.GreaterThan,
|
|
||||||
.LessOrEqual,
|
|
||||||
.LessThan,
|
|
||||||
.MergeErrorSets,
|
|
||||||
.Mod,
|
|
||||||
.Mul,
|
|
||||||
.MulWrap,
|
|
||||||
.Period,
|
|
||||||
.Range,
|
|
||||||
.Sub,
|
|
||||||
.SubWrap,
|
|
||||||
.UnwrapOptional,
|
|
||||||
.AddressOf,
|
|
||||||
.Await,
|
|
||||||
.BitNot,
|
|
||||||
.BoolNot,
|
|
||||||
.OptionalType,
|
|
||||||
.Negation,
|
|
||||||
.NegationWrap,
|
|
||||||
.Resume,
|
|
||||||
.Try,
|
|
||||||
.ArrayType,
|
|
||||||
.ArrayTypeSentinel,
|
|
||||||
.PtrType,
|
|
||||||
.SliceType, .SuffixOp, .ControlFlowExpression, .ArrayInitializerDot, .SwitchElse, .SwitchCase, .For, .EnumLiteral, .PointerIndexPayload, .StructInitializerDot, .PointerPayload, .While, .Switch, .Else, .BoolLiteral, .NullLiteral, .Defer, .StructInitializer, .FieldInitializer, .If, .MultilineStringLiteral, .UndefinedLiteral, .AnyType, .Block, .ErrorSetDecl => return,
|
|
||||||
|
|
||||||
.ContainerDecl => {
|
.ContainerDecl => {
|
||||||
const decl = child.castTag(.ContainerDecl).?;
|
const decl = child.castTag(.ContainerDecl).?;
|
||||||
|
@ -214,7 +214,7 @@ fn symbolReferencesInternal(
|
|||||||
const info = switch (node.tag) {
|
const info = switch (node.tag) {
|
||||||
.PtrType => node.castTag(.PtrType).?.ptr_info,
|
.PtrType => node.castTag(.PtrType).?.ptr_info,
|
||||||
.SliceType => node.castTag(.SliceType).?.ptr_info,
|
.SliceType => node.castTag(.SliceType).?.ptr_info,
|
||||||
else => return
|
else => return,
|
||||||
};
|
};
|
||||||
const prefix_op = node.cast(ast.Node.SimplePrefixOp).?;
|
const prefix_op = node.cast(ast.Node.SimplePrefixOp).?;
|
||||||
|
|
||||||
@ -317,50 +317,47 @@ fn symbolReferencesInternal(
|
|||||||
const test_decl = node.cast(ast.Node.TestDecl).?;
|
const test_decl = node.cast(ast.Node.TestDecl).?;
|
||||||
try symbolReferencesInternal(arena, store, .{ .node = test_decl.body_node, .handle = handle }, decl, encoding, context, handler);
|
try symbolReferencesInternal(arena, store, .{ .node = test_decl.body_node, .handle = handle }, decl, encoding, context, handler);
|
||||||
},
|
},
|
||||||
else => {
|
.Period => {
|
||||||
// switch (ast.Node.Tag.Type(node.tag)) {
|
const infix_op = node.cast(ast.Node.SimpleInfixOp).?;
|
||||||
// SimpleInfixOp => {
|
|
||||||
// switch (node.tag) {
|
|
||||||
// .Period => {
|
|
||||||
// try symbolReferencesInternal(arena, store, .{ .node = infix_op.lhs, .handle = handle }, decl, encoding, context, handler);
|
|
||||||
|
|
||||||
// const rhs_str = analysis.nodeToString(handle.tree, infix_op.rhs) orelse return;
|
try symbolReferencesInternal(arena, store, .{ .node = infix_op.lhs, .handle = handle }, decl, encoding, context, handler);
|
||||||
// var bound_type_params = analysis.BoundTypeParams.init(&arena.allocator);
|
|
||||||
// const left_type = try analysis.resolveFieldAccessLhsType(
|
|
||||||
// store,
|
|
||||||
// arena,
|
|
||||||
// (try analysis.resolveTypeOfNodeInternal(store, arena, .{
|
|
||||||
// .node = infix_op.lhs,
|
|
||||||
// .handle = handle,
|
|
||||||
// }, &bound_type_params)) orelse return,
|
|
||||||
// &bound_type_params,
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const left_type_node = switch (left_type.type.data) {
|
const rhs_str = analysis.nodeToString(handle.tree, infix_op.rhs) orelse return;
|
||||||
// .other => |n| n,
|
var bound_type_params = analysis.BoundTypeParams.init(&arena.allocator);
|
||||||
// else => return,
|
const left_type = try analysis.resolveFieldAccessLhsType(
|
||||||
// };
|
store,
|
||||||
|
arena,
|
||||||
|
(try analysis.resolveTypeOfNodeInternal(store, arena, .{
|
||||||
|
.node = infix_op.lhs,
|
||||||
|
.handle = handle,
|
||||||
|
}, &bound_type_params)) orelse return,
|
||||||
|
&bound_type_params,
|
||||||
|
);
|
||||||
|
|
||||||
// if (try analysis.lookupSymbolContainer(
|
const left_type_node = switch (left_type.type.data) {
|
||||||
// store,
|
.other => |n| n,
|
||||||
// arena,
|
else => return,
|
||||||
// .{ .node = left_type_node, .handle = left_type.handle },
|
};
|
||||||
// rhs_str,
|
|
||||||
// !left_type.type.is_type_val,
|
if (try analysis.lookupSymbolContainer(
|
||||||
// )) |child| {
|
store,
|
||||||
// if (std.meta.eql(child, decl)) {
|
arena,
|
||||||
// try tokenReference(handle, infix_op.rhs.firstToken(), encoding, context, handler);
|
.{ .node = left_type_node, .handle = left_type.handle },
|
||||||
// }
|
rhs_str,
|
||||||
// }
|
!left_type.type.is_type_val,
|
||||||
// },
|
)) |child| {
|
||||||
// else => {
|
if (std.meta.eql(child, decl)) {
|
||||||
// try symbolReferencesInternal(arena, store, .{ .node = infix_op.lhs, .handle = handle }, decl, encoding, context, handler);
|
try tokenReference(handle, infix_op.rhs.firstToken(), encoding, context, handler);
|
||||||
// try symbolReferencesInternal(arena, store, .{ .node = infix_op.rhs, .handle = handle }, decl, encoding, context, handler);
|
}
|
||||||
// },
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
|
.Add, .AddWrap, .ArrayCat, .ArrayMult, .Assign, .AssignBitAnd, .AssignBitOr, .AssignBitShiftLeft, .AssignBitShiftRight, .AssignBitXor, .AssignDiv, .AssignSub, .AssignSubWrap, .AssignMod, .AssignAdd, .AssignAddWrap, .AssignMul, .AssignMulWrap, .BangEqual, .BitAnd, .BitOr, .BitShiftLeft, .BitShiftRight, .BitXor, .BoolOr, .Div, .EqualEqual, .ErrorUnion, .GreaterOrEqual, .GreaterThan, .LessOrEqual, .LessThan, .MergeErrorSets, .Mod, .Mul, .MulWrap, .Range, .Sub, .SubWrap, .UnwrapOptional => {
|
||||||
|
const infix_op = node.cast(ast.Node.SimpleInfixOp).?;
|
||||||
|
|
||||||
|
try symbolReferencesInternal(arena, store, .{ .node = infix_op.lhs, .handle = handle }, decl, encoding, context, handler);
|
||||||
|
try symbolReferencesInternal(arena, store, .{ .node = infix_op.rhs, .handle = handle }, decl, encoding, context, handler);
|
||||||
|
},
|
||||||
|
else => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user