aboutsummaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorDaniel Gavin <danielgavin5@hotmail.com>2021-11-08 14:00:13 +0100
committerDaniel Gavin <danielgavin5@hotmail.com>2021-11-08 14:00:13 +0100
commit147c91a0f4c263404caff128461a3150c785ea4c (patch)
tree9329acf661ee74552679fe09e68a77241ee43c12 /src/analysis
parent75c285df42289f366c3a44dc8e68c24cffc3d750 (diff)
Fix completion error in make generics, and also fixed completion in switch stmt.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/analysis.odin18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/analysis/analysis.odin b/src/analysis/analysis.odin
index ec42378..362c7b5 100644
--- a/src/analysis/analysis.odin
+++ b/src/analysis/analysis.odin
@@ -654,7 +654,7 @@ resolve_function_overload :: proc(ast_context: ^AstContext, group: ast.Proc_Grou
call_expr := ast_context.call;
- candidates := make([dynamic] index.Symbol, context.temp_allocator);
+ candidates := make([dynamic]index.Symbol, context.temp_allocator);
for arg_expr in group.args {
@@ -675,13 +675,6 @@ resolve_function_overload :: proc(ast_context: ^AstContext, group: ast.Proc_Grou
}
}
- /*
- Don't give up
- if count_required_params > len(call_expr.args) {
- break next_fn;
- }
- */
-
if len(procedure.arg_types) < len(call_expr.args) {
continue;
}
@@ -715,7 +708,7 @@ resolve_function_overload :: proc(ast_context: ^AstContext, group: ast.Proc_Grou
call_symbol, ok = resolve_type_expression(ast_context, arg);
}
- if !ok {
+ if !ok {
break next_fn;
}
@@ -725,7 +718,7 @@ resolve_function_overload :: proc(ast_context: ^AstContext, group: ast.Proc_Grou
arg_symbol, ok = resolve_type_expression(ast_context, procedure.arg_types[i].default_value);
}
- if !ok {
+ if !ok {
break next_fn;
}
@@ -1127,6 +1120,7 @@ resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ident) -> (i
} else if node.name == "context" {
for built in index.indexer.built_in_packages {
if symbol, ok := index.lookup("Context", built); ok {
+ ast_context.current_package = built;
return symbol, ok;
}
}
@@ -1917,6 +1911,10 @@ get_locals_stmt :: proc(file: ast.File, stmt: ^ast.Stmt, ast_context: ^AstContex
case When_Stmt:
get_locals_stmt(file, v.else_stmt, ast_context, document_position);
get_locals_stmt(file, v.body, ast_context, document_position);
+ case Case_Clause:
+ for stmt in v.body {
+ get_locals_stmt(file, stmt, ast_context, document_position);
+ }
case:
//log.debugf("default node local stmt %v", v);
}