diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2024-05-11 23:39:53 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2024-05-11 23:39:53 +0200 |
| commit | 30625d5568c085c622deece91ed8ac9e81ba28be (patch) | |
| tree | 84eb3f3e4c9b38724f10b18303aa46596af4329a /src/server/generics.odin | |
| parent | 1d2df42baa781a4838393b533601af35f9e30246 (diff) | |
Refractor ast_context.current_package now being called through defered functions
Diffstat (limited to 'src/server/generics.odin')
| -rw-r--r-- | src/server/generics.odin | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/server/generics.odin b/src/server/generics.odin index a2393d0..9c44cf5 100644 --- a/src/server/generics.odin +++ b/src/server/generics.odin @@ -254,6 +254,24 @@ resolve_poly :: proc( return true } } + case ^ast.Comp_Lit: + if comp_lit, ok := call_node.derived.(^ast.Comp_Lit); ok { + if poly_type, ok := p.type.derived.(^ast.Poly_Type); ok { + if ident, ok := unwrap_ident(poly_type.type); ok { + poly_map[ident.name] = comp_lit.type + } + + if poly_type.specialization != nil { + return resolve_poly( + ast_context, + comp_lit.type, + call_symbol, + p.type, + poly_map, + ) + } + } + } case ^ast.Ident: if n, ok := call_node.derived.(^ast.Ident); ok { return true @@ -348,6 +366,12 @@ find_and_replace_poly_type :: proc( poly_map := cast(^map[string]^ast.Expr)visitor.data #partial switch v in node.derived { + case ^ast.Comp_Lit: + if expr, ok := is_in_poly_map(v.type, poly_map); ok { + v.type = expr + v.pos.file = expr.pos.file + v.end.file = expr.end.file + } case ^ast.Matrix_Type: if expr, ok := is_in_poly_map(v.elem, poly_map); ok { v.elem = expr @@ -484,6 +508,8 @@ resolve_generic_function_symbol :: proc( reset_ast_context(ast_context) + ast_context.current_package = ast_context.document_package + if symbol, ok := resolve_type_expression( ast_context, call_expr.args[i], |