Merge pull request #590 from Techatrix/fix-enum-signature

Better handling for enum field signatures
This commit is contained in:
Auguste Rame 2022-08-21 03:07:10 +02:00 committed by GitHub
commit cef1e83430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,6 +222,9 @@ pub fn getVariableSignature(tree: Ast, var_decl: Ast.full.VarDecl) []const u8 {
} }
pub fn getContainerFieldSignature(tree: Ast, field: Ast.full.ContainerField) []const u8 { pub fn getContainerFieldSignature(tree: Ast, field: Ast.full.ContainerField) []const u8 {
if(field.ast.value_expr == 0 and field.ast.type_expr == 0 and field.ast.align_expr == 0) {
return ""; // TODO display the container's type
}
const start = offsets.tokenLocation(tree, field.ast.name_token).start; const start = offsets.tokenLocation(tree, field.ast.name_token).start;
const end_node = if (field.ast.value_expr != 0) field.ast.value_expr else field.ast.type_expr; const end_node = if (field.ast.value_expr != 0) field.ast.value_expr else field.ast.type_expr;
const end = offsets.tokenLocation(tree, ast.lastToken(tree, end_node)).end; const end = offsets.tokenLocation(tree, ast.lastToken(tree, end_node)).end;