From a07efabcc54bea23707c4fa5e558f68f90ce42fa Mon Sep 17 00:00:00 2001 From: Daniel Gavin Date: Thu, 30 Dec 2021 02:32:35 +0100 Subject: refractor with bitsets, and fix inlined struct/union/enum --- src/index/collector.odin | 15 ++++++++++++--- src/index/symbol.odin | 15 +++++++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'src/index') diff --git a/src/index/collector.odin b/src/index/collector.odin index 74c47e1..11e949a 100644 --- a/src/index/collector.odin +++ b/src/index/collector.odin @@ -371,9 +371,18 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri symbol.pkg = get_index_unique_string(collection, directory); symbol.type = token_type; symbol.doc = common.get_doc(expr.docs, collection.allocator); - symbol.is_deprecated = expr.deprecated; - symbol.is_private_file = expr.file_private; - symbol.is_private_package = expr.package_private; + + if expr.deprecated { + symbol.flags |= {.Deprecated}; + } + + if expr.file_private { + symbol.flags |= {.PrivateFile}; + } + + if expr.package_private { + symbol.flags |= {.PrivatePackage}; + } when ODIN_OS == "windows" { symbol.uri = get_index_unique_string(collection, strings.to_lower(uri, context.temp_allocator)); diff --git a/src/index/symbol.odin b/src/index/symbol.odin index 8e13786..e2ebad5 100644 --- a/src/index/symbol.odin +++ b/src/index/symbol.odin @@ -102,6 +102,16 @@ SymbolValue :: union { SymbolUntypedValue, } +SymbolFlag :: enum { + Distinct, + Deprecated, + PrivateFile, + PrivatePackage, + Anonymous, +} + +SymbolFlags :: bit_set[SymbolFlag] + Symbol :: struct { range: common.Range, uri: string, @@ -114,10 +124,7 @@ Symbol :: struct { value: SymbolValue, references: []common.Location, pointers: int, - is_distinct: bool, - is_deprecated: bool, - is_private_file: bool, - is_private_package: bool, + flags: SymbolFlags, } SymbolType :: enum { -- cgit v1.2.3