aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2021-04-02 12:36:57 +0200
committerDanielGavin <danielgavin5@hotmail.com>2021-04-02 12:36:57 +0200
commit111f6ccb5221734ba5ef8f95a03253df83df1a70 (patch)
tree4de0da6d45b1010c55b0146e8fe5e5e8938fa90a /src/server
parent8a760dfbebffbdd091508c026c26c792ef11bb29 (diff)
extract the distinct type in locals and globals
Diffstat (limited to 'src/server')
-rw-r--r--src/server/analysis.odin13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index 5d7cc40..8e5f38b 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -742,6 +742,12 @@ resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) -> (i
//note(Daniel, if global and local ends up being 100% same just make a function that takes the map)
if local := get_local(ast_context, node.pos.offset, node.name); local != nil && ast_context.use_locals {
+ if dist, ok := local.derived.(ast.Distinct_Type); ok {
+ if dist.type != nil {
+ local = dist.type; //save information for overloading
+ }
+ }
+
switch v in local.derived {
case Ident:
@@ -775,10 +781,15 @@ resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) -> (i
case:
log.warnf("default type node kind: %T", v);
return resolve_type_expression(ast_context, local);
- //return make_symbol_generic_from_ast(ast_context, local), true;
}
} else if global, ok := ast_context.globals[node.name]; ast_context.use_globals && ok {
+ if dist, ok := global.derived.(ast.Distinct_Type); ok {
+ if dist.type != nil {
+ global = dist.type; //save information for overloading
+ }
+ }
+
switch v in global.derived {
case Ident: