implement completion for error sets

This commit is contained in:
Vexu 2020-05-14 19:11:03 +03:00
parent db6407ea3b
commit a739bf6499
No known key found for this signature in database
GPG Key ID: 59AEB8936E16A6AC

View File

@ -214,6 +214,9 @@ pub fn resolveTypeOfNode(analysis_ctx: *AnalysisContext, node: *ast.Node) ?*ast.
const field = node.cast(ast.Node.ContainerField).?;
return resolveTypeOfNode(analysis_ctx, field.type_expr orelse return null);
},
.ErrorSetDecl => {
return node;
},
.SuffixOp => {
const suffix_op = node.cast(ast.Node.SuffixOp).?;
switch (suffix_op.op) {
@ -371,6 +374,10 @@ pub fn nodeToString(tree: *ast.Tree, node: *ast.Node) ?[]const u8 {
const field = node.cast(ast.Node.ContainerField).?;
return tree.tokenSlice(field.name_token);
},
.ErrorTag => {
const tag = node.cast(ast.Node.ErrorTag).?;
return tree.tokenSlice(tag.name_token);
},
.Identifier => {
const field = node.cast(ast.Node.Identifier).?;
return tree.tokenSlice(field.token);