aboutsummaryrefslogtreecommitdiff
path: root/src/server/analysis.odin
diff options
context:
space:
mode:
authorNathaniel Saxe <NathanielSaxophone@gmail.com>2026-02-03 13:36:26 -0500
committerGitHub <noreply@github.com>2026-02-03 13:36:26 -0500
commit358a0d4df11731e18231da055813e7e6301ce4db (patch)
tree3969d79743e1c1c2a3b5614a8579c040e31b6b5d /src/server/analysis.odin
parent1dddd343a6e2a70cba078379dcfde0d62cd28a7c (diff)
parent68f7e739157f84c70d368c55d55f4996a61008e9 (diff)
Merge branch 'master' into master
Diffstat (limited to 'src/server/analysis.odin')
-rw-r--r--src/server/analysis.odin50
1 files changed, 40 insertions, 10 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 3ced0ad..c9cd863 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -1,4 +1,5 @@
#+feature dynamic-literals
+#+feature using-stmt
package server
import "core:fmt"
@@ -1385,10 +1386,14 @@ resolve_call_directive :: proc(ast_context: ^AstContext, call: ^ast.Call_Expr) -
if len(call.args) == 1 {
ident := new_type(ast.Ident, call.pos, call.end, ast_context.allocator)
ident.name = "u8"
- value := SymbolSliceValue{
- expr = ident
+ value := SymbolSliceValue {
+ expr = ident,
+ }
+ symbol := Symbol {
+ name = "#load",
+ pkg = ast_context.current_package,
+ value = value,
}
- symbol := Symbol{name = "#load", pkg = ast_context.current_package, value = value}
return symbol, true
} else if len(call.args) == 2 {
return resolve_type_expression(ast_context, call.args[1])
@@ -1407,10 +1412,14 @@ resolve_call_directive :: proc(ast_context: ^AstContext, call: ^ast.Call_Expr) -
selector := new_type(ast.Selector_Expr, call.pos, call.end, ast_context.allocator)
selector.expr = pkg
selector.field = field
- value := SymbolSliceValue{
- expr = selector
+ value := SymbolSliceValue {
+ expr = selector,
+ }
+ symbol := Symbol {
+ name = "#load_directory",
+ pkg = ast_context.current_package,
+ value = value,
}
- symbol := Symbol{name = "#load_directory", pkg = ast_context.current_package, value = value}
return symbol, true
}
@@ -1429,11 +1438,23 @@ resolve_index_expr :: proc(ast_context: ^AstContext, index_expr: ^ast.Index_Expr
#partial switch v in indexed.value {
case SymbolDynamicArrayValue:
+ if .Soa in indexed.flags {
+ indexed.flags |= { .SoaPointer }
+ return indexed, true
+ }
ok = internal_resolve_type_expression(ast_context, v.expr, &symbol)
case SymbolSliceValue:
ok = internal_resolve_type_expression(ast_context, v.expr, &symbol)
+ if .Soa in indexed.flags {
+ indexed.flags |= { .SoaPointer }
+ return indexed, true
+ }
case SymbolFixedArrayValue:
ok = internal_resolve_type_expression(ast_context, v.expr, &symbol)
+ if .Soa in indexed.flags {
+ indexed.flags |= { .SoaPointer }
+ return indexed, true
+ }
case SymbolMapValue:
ok = internal_resolve_type_expression(ast_context, v.value, &symbol)
case SymbolMultiPointerValue:
@@ -1471,6 +1492,9 @@ resolve_index_expr :: proc(ast_context: ^AstContext, index_expr: ^ast.Index_Expr
}
symbol.type = indexed.type
+ if .Soa in indexed.flags {
+ symbol.flags |= {.SoaPointer}
+ }
return symbol, ok
}
@@ -1954,12 +1978,15 @@ resolve_local_identifier :: proc(ast_context: ^AstContext, node: ast.Ident, loca
if .Variable in local.flags {
return_symbol.flags |= {.Variable}
}
+ if .PolyType in local.flags {
+ return_symbol.flags |= {.PolyType}
+ }
return_symbol.flags |= {.Local}
return_symbol.value_expr = local.value_expr
return_symbol.type_expr = local.type_expr
- return_symbol.doc = get_doc(local.docs, ast_context.allocator)
- return_symbol.comment = get_comment(local.comment)
+ return_symbol.doc = get_comment(local.docs, ast_context.allocator)
+ return_symbol.comment = get_comment(local.comment, ast_context.allocator)
return return_symbol, ok
}
@@ -2048,11 +2075,11 @@ resolve_global_identifier :: proc(ast_context: ^AstContext, node: ast.Ident, glo
}
if global.docs != nil {
- return_symbol.doc = get_doc(global.docs, ast_context.allocator)
+ return_symbol.doc = get_comment(global.docs, ast_context.allocator)
}
if global.comment != nil {
- return_symbol.comment = get_comment(global.comment)
+ return_symbol.comment = get_comment(global.comment, ast_context.allocator)
}
return_symbol.type_expr = global.type_expr
@@ -2273,6 +2300,9 @@ internal_resolve_comp_literal :: proc(
set_ast_package_set_scoped(ast_context, symbol.pkg)
+ if position_context.parent_comp_lit == nil {
+ return {}, false
+ }
symbol, _ = resolve_type_comp_literal(
ast_context,
position_context,