aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2022-06-13 21:27:04 +0200
committerDaniel Gavin <danielgavin5@hotmail.com>2022-06-13 21:27:04 +0200
commitfd568075da8bf95ca37159454f37e085d5134b1d (patch)
tree346a67bb3ce1097cc2bd605b0698d7b66837e931 /src
parentef17561468edad57f6a1d0fdeec20b8ee8f7c936 (diff)
Fix stackoverflow error with unresolved generic expression.
Diffstat (limited to 'src')
-rw-r--r--src/server/analysis.odin12
-rw-r--r--src/server/collector.odin2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 62b3da9..0686743 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1431,7 +1431,9 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: Symbol, ok := tr
symbol := symbol
if symbol.type == .Unresolved {
- resolve_unresolved_symbol(ast_context, &symbol)
+ if !resolve_unresolved_symbol(ast_context, &symbol) {
+ return {}, false
+ }
}
#partial switch v in &symbol.value {
@@ -1490,9 +1492,9 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: Symbol, ok := tr
return symbol, true
}
-resolve_unresolved_symbol :: proc(ast_context: ^AstContext, symbol: ^Symbol) {
+resolve_unresolved_symbol :: proc(ast_context: ^AstContext, symbol: ^Symbol) -> bool {
if symbol.type != .Unresolved {
- return
+ return true
}
#partial switch v in symbol.value {
@@ -1513,8 +1515,12 @@ resolve_unresolved_symbol :: proc(ast_context: ^AstContext, symbol: ^Symbol) {
if ret, ok := resolve_type_expression(ast_context, v.expr); ok {
symbol.type = ret.type
symbol.signature = ret.signature
+ } else {
+ return false
}
}
+
+ return true
}
resolve_location_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) -> (Symbol, bool) {
diff --git a/src/server/collector.odin b/src/server/collector.odin
index 632a94c..47ebb98 100644
--- a/src/server/collector.odin
+++ b/src/server/collector.odin
@@ -391,7 +391,7 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri
if expr.builtin || strings.contains(uri, "builtin.odin") {
symbol.pkg = "$builtin"
- } else if strings.contains(uri, "builtin.odin") {
+ } else if strings.contains(uri, "intrinsics.odin") {
symbol.pkg = "$intrinsics"
} else {
symbol.pkg = get_index_unique_string(collection, directory)