Skip to content

Commit

Permalink
Handle parser not returning valid global decls.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielGavin committed Jan 27, 2024
1 parent 4e7714e commit 0ec5ed3
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/server/analysis.odin
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
}

Expand Down Expand Up @@ -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{},
}

Expand All @@ -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{},
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 0ec5ed3

Please sign in to comment.