Merge pull request #473 from nektro/zig-10.1679
update to zig master 0.10.0-dev.1679+d227f76af
This commit is contained in:
commit
fd2a863245
@ -107,7 +107,7 @@ pub fn getFunctionSnippet(allocator: std.mem.Allocator, tree: Ast, func: Ast.ful
|
|||||||
|
|
||||||
const token_tags = tree.tokens.items(.tag);
|
const token_tags = tree.tokens.items(.tag);
|
||||||
|
|
||||||
var it = func.iterate(tree);
|
var it = func.iterate(&tree);
|
||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while (it.next()) |param| : (i += 1) {
|
while (it.next()) |param| : (i += 1) {
|
||||||
if (skip_self_param and i == 0) continue;
|
if (skip_self_param and i == 0) continue;
|
||||||
@ -161,7 +161,7 @@ pub fn hasSelfParam(arena: *std.heap.ArenaAllocator, document_store: *DocumentSt
|
|||||||
if (func.ast.params.len == 0) return false;
|
if (func.ast.params.len == 0) return false;
|
||||||
|
|
||||||
const tree = handle.tree;
|
const tree = handle.tree;
|
||||||
var it = func.iterate(tree);
|
var it = func.iterate(&tree);
|
||||||
const param = it.next().?;
|
const param = it.next().?;
|
||||||
if (param.type_expr == 0) return false;
|
if (param.type_expr == 0) return false;
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ pub fn isTypeFunction(tree: Ast, func: Ast.full.FnProto) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn isGenericFunction(tree: Ast, func: Ast.full.FnProto) bool {
|
pub fn isGenericFunction(tree: Ast, func: Ast.full.FnProto) bool {
|
||||||
var it = func.iterate(tree);
|
var it = func.iterate(&tree);
|
||||||
while (it.next()) |param| {
|
while (it.next()) |param| {
|
||||||
if (param.anytype_ellipsis3 != null or param.comptime_noalias != null) {
|
if (param.anytype_ellipsis3 != null or param.comptime_noalias != null) {
|
||||||
return true;
|
return true;
|
||||||
@ -723,7 +723,7 @@ pub fn resolveTypeOfNodeInternal(store: *DocumentStore, arena: *std.heap.ArenaAl
|
|||||||
var expected_params = fn_decl.ast.params.len;
|
var expected_params = fn_decl.ast.params.len;
|
||||||
// If we call as method, the first parameter should be skipped
|
// If we call as method, the first parameter should be skipped
|
||||||
// TODO: Back-parse to extract the self argument?
|
// TODO: Back-parse to extract the self argument?
|
||||||
var it = fn_decl.iterate(decl.handle.tree);
|
var it = fn_decl.iterate(&decl.handle.tree);
|
||||||
if (token_tags[call.ast.lparen - 2] == .period) {
|
if (token_tags[call.ast.lparen - 2] == .period) {
|
||||||
if (try hasSelfParam(arena, store, decl.handle, fn_decl)) {
|
if (try hasSelfParam(arena, store, decl.handle, fn_decl)) {
|
||||||
_ = it.next();
|
_ = it.next();
|
||||||
@ -2600,7 +2600,7 @@ fn makeScopeInternal(allocator: std.mem.Allocator, context: ScopeContext, node_i
|
|||||||
var scope_idx = scopes.items.len - 1;
|
var scope_idx = scopes.items.len - 1;
|
||||||
errdefer scopes.items[scope_idx].decls.deinit();
|
errdefer scopes.items[scope_idx].decls.deinit();
|
||||||
|
|
||||||
var it = func.iterate(tree);
|
var it = func.iterate(&tree);
|
||||||
while (it.next()) |param| {
|
while (it.next()) |param| {
|
||||||
// Add parameter decls
|
// Add parameter decls
|
||||||
if (param.name_token) |name_token| {
|
if (param.name_token) |name_token| {
|
||||||
|
@ -146,7 +146,7 @@ fn symbolReferencesInternal(arena: *std.heap.ArenaAllocator, store: *DocumentSto
|
|||||||
=> {
|
=> {
|
||||||
var buf: [1]Ast.Node.Index = undefined;
|
var buf: [1]Ast.Node.Index = undefined;
|
||||||
const fn_proto = ast.fnProto(tree, node, &buf).?;
|
const fn_proto = ast.fnProto(tree, node, &buf).?;
|
||||||
var it = fn_proto.iterate(tree);
|
var it = fn_proto.iterate(&tree);
|
||||||
while (it.next()) |param| {
|
while (it.next()) |param| {
|
||||||
if (param.type_expr != 0)
|
if (param.type_expr != 0)
|
||||||
try symbolReferencesInternal(arena, store, .{ .node = param.type_expr, .handle = handle }, decl, encoding, context, handler);
|
try symbolReferencesInternal(arena, store, .{ .node = param.type_expr, .handle = handle }, decl, encoding, context, handler);
|
||||||
@ -547,7 +547,7 @@ pub fn symbolReferences(arena: *std.heap.ArenaAllocator, store: *DocumentStore,
|
|||||||
.function => |proto| {
|
.function => |proto| {
|
||||||
var buf: [1]Ast.Node.Index = undefined;
|
var buf: [1]Ast.Node.Index = undefined;
|
||||||
const fn_proto = ast.fnProto(curr_handle.tree, proto, &buf).?;
|
const fn_proto = ast.fnProto(curr_handle.tree, proto, &buf).?;
|
||||||
var it = fn_proto.iterate(curr_handle.tree);
|
var it = fn_proto.iterate(&curr_handle.tree);
|
||||||
while (it.next()) |candidate| {
|
while (it.next()) |candidate| {
|
||||||
if (std.meta.eql(candidate, param)) {
|
if (std.meta.eql(candidate, param)) {
|
||||||
if (curr_handle.tree.nodes.items(.tag)[proto] == .fn_decl) {
|
if (curr_handle.tree.nodes.items(.tag)[proto] == .fn_decl) {
|
||||||
|
@ -475,7 +475,7 @@ fn writeNodeTokens(builder: *Builder, arena: *std.heap.ArenaAllocator, store: *D
|
|||||||
|
|
||||||
try writeTokenMod(builder, fn_proto.name_token, func_name_tok_type, tok_mod);
|
try writeTokenMod(builder, fn_proto.name_token, func_name_tok_type, tok_mod);
|
||||||
|
|
||||||
var it = fn_proto.iterate(tree);
|
var it = fn_proto.iterate(&tree);
|
||||||
while (it.next()) |param_decl| {
|
while (it.next()) |param_decl| {
|
||||||
if (param_decl.first_doc_comment) |docs| try writeDocComments(builder, tree, docs);
|
if (param_decl.first_doc_comment) |docs| try writeDocComments(builder, tree, docs);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ fn fnProtoToSignatureInfo(document_store: *DocumentStore, arena: *std.heap.Arena
|
|||||||
} else commas;
|
} else commas;
|
||||||
|
|
||||||
var params = std.ArrayListUnmanaged(ParameterInformation){};
|
var params = std.ArrayListUnmanaged(ParameterInformation){};
|
||||||
var param_it = proto.iterate(tree);
|
var param_it = proto.iterate(&tree);
|
||||||
while (param_it.next()) |param| {
|
while (param_it.next()) |param| {
|
||||||
const param_comments = if (param.first_doc_comment) |dc|
|
const param_comments = if (param.first_doc_comment) |dc|
|
||||||
try analysis.collectDocComments(alloc, tree, dc, .Markdown, false)
|
try analysis.collectDocComments(alloc, tree, dc, .Markdown, false)
|
||||||
|
Loading…
Reference in New Issue
Block a user