From 0ec5ed35af349f4a5f6ab5497da1b8e3029132e1 Mon Sep 17 00:00:00 2001 From: DanielGavin Date: Sat, 27 Jan 2024 19:19:11 +0100 Subject: [PATCH] Handle parser not returning valid global decls. --- src/server/analysis.odin | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 0789736c..a92599b1 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1253,8 +1253,8 @@ internal_resolve_type_identifier :: proc( for imp in ast_context.imports { if strings.compare(imp.base, node.name) == 0 { symbol := Symbol { - type = .Package, - pkg = imp.name, + type = .Package, + pkg = imp.name, value = SymbolPackageValue{}, } @@ -1510,8 +1510,8 @@ internal_resolve_type_identifier :: proc( //right now we replace the package ident with the absolute directory name, so it should have '/' which is not a valid ident character if strings.contains(node.name, "/") { symbol := Symbol { - type = .Package, - pkg = node.name, + type = .Package, + pkg = node.name, value = SymbolPackageValue{}, } @@ -1528,8 +1528,8 @@ internal_resolve_type_identifier :: proc( for imp in ast_context.imports { if strings.compare(imp.base, node.name) == 0 { symbol := Symbol { - type = .Package, - pkg = imp.name, + type = .Package, + pkg = imp.name, value = SymbolPackageValue{}, } @@ -3567,6 +3567,10 @@ resolve_entire_file :: proc( symbols := make(map[uintptr]SymbolAndNode, 10000, allocator) for decl in document.ast.decls { + if _, is_value := decl.derived.(^ast.Value_Decl); !is_value { + continue + } + resolve_entire_decl( &ast_context, document, @@ -4509,10 +4513,10 @@ fallback_position_context_completion :: proc( } p := parser.Parser { - err = common.parser_warning_handler, //empty - warn = common.parser_warning_handler, //empty + err = common.parser_warning_handler, //empty + warn = common.parser_warning_handler, //empty flags = {.Optional_Semicolons}, - file = &position_context.file, + file = &position_context.file, } tokenizer.init(