aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-10-27 13:21:00 +0200
committerDaniel Gavin <danielgavin5@hotmail.com>2022-10-27 13:21:00 +0200
commit7415292f695102c94b6d97e8a28ffc99da71ac30 (patch)
treebb9af9e309ea07d81067cef1cd7b69f8af0ab184 /src/server
parent2cf49d9cda4ec5ab480d71da3da37ee2b71fc6f4 (diff)
Handle typeid as a type
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin9
-rw-r--r--src/server/collector.odin9
2 files changed, 15 insertions, 3 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 42e02cd..7050471 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1093,6 +1093,10 @@ internal_resolve_type_expression :: proc(
using ast
#partial switch v in node.derived {
+ case ^ast.Typeid_Type:
+ ident := new_type(ast.Ident, v.pos, v.end, context.temp_allocator)
+ ident.name = "typeid"
+ return make_symbol_basic_type_from_ast(ast_context, ident), true
case ^ast.Value_Decl:
if v.type != nil {
return internal_resolve_type_expression(ast_context, v.type)
@@ -2364,8 +2368,7 @@ make_symbol_map_from_ast :: proc(
make_symbol_basic_type_from_ast :: proc(
ast_context: ^AstContext,
- n: ^ast.Node,
- v: ^ast.Ident,
+ n: ^ast.Ident,
) -> Symbol {
symbol := Symbol {
range = common.get_token_range(n^, ast_context.file.src),
@@ -2374,7 +2377,7 @@ make_symbol_basic_type_from_ast :: proc(
}
symbol.value = SymbolBasicValue {
- ident = v,
+ ident = n,
}
return symbol
diff --git a/src/server/collector.odin b/src/server/collector.odin
index 913d66f..9a7d050 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -492,6 +492,15 @@ collect_symbols :: proc(
token = v^
token_type = .Variable
symbol.value = collect_multi_pointer(collection, v^, package_map)
+ case ^ast.Typeid_Type:
+ if v.specialization == nil {
+ continue
+ }
+
+ ident := new_type(ast.Ident, v.pos, v.end, context.temp_allocator)
+ ident.name = "typeid"
+
+ symbol.value = collect_generic(collection, ident, package_map, uri)
case ^ast.Basic_Lit:
token = v^
symbol.value = collect_generic(