diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-07-11 19:08:27 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-07-11 19:08:27 +0200 |
| commit | 9192498f8f6c463015a4f8ce1904d28aa862133f (patch) | |
| tree | 7e912b0e64656fbed5410f0103c88ed2aa42ca05 | |
| parent | 83b825e689d22e3e36d44c170e86cb1062f84b11 (diff) | |
Improve robustness on scope package
| -rw-r--r-- | src/server/analysis.odin | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index b5cd385..dd7b3b0 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -137,7 +137,9 @@ make_ast_context :: proc( } set_ast_package_deferred :: proc(ast_context: ^AstContext, pkg: string) { - assert(ast_context.deferred_count > 0) + if ast_context.deferred_count <= 0 { + return + } ast_context.deferred_count -= 1 ast_context.current_package = ast_context.deferred_package[ast_context.deferred_count] @@ -155,7 +157,9 @@ set_ast_package_set_scoped :: proc(ast_context: ^AstContext, pkg: string) { } set_ast_package_none_deferred :: proc(ast_context: ^AstContext) { - assert(ast_context.deferred_count > 0) + if ast_context.deferred_count <= 0 { + return + } ast_context.deferred_count -= 1 ast_context.current_package = ast_context.deferred_package[ast_context.deferred_count] @@ -175,7 +179,9 @@ set_ast_package_from_symbol_deferred :: proc( ast_context: ^AstContext, symbol: Symbol, ) { - assert(ast_context.deferred_count > 0) + if ast_context.deferred_count <= 0 { + return + } ast_context.deferred_count -= 1 ast_context.current_package = ast_context.deferred_package[ast_context.deferred_count] |