diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-30 02:32:35 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2021-12-30 02:32:35 +0100 |
| commit | a07efabcc54bea23707c4fa5e558f68f90ce42fa (patch) | |
| tree | 29ab3107245bf1a43b3881887db070817db825aa /src/index | |
| parent | 3ac23cfce721a19ad939750c2202685edc44d62c (diff) | |
refractor with bitsets, and fix inlined struct/union/enum
Diffstat (limited to 'src/index')
| -rw-r--r-- | src/index/collector.odin | 15 | ||||
| -rw-r--r-- | src/index/symbol.odin | 15 |
2 files changed, 23 insertions, 7 deletions
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 { |