aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanielGavin <danielgavin5@hotmail.com>2020-11-20 13:44:56 +0100
committerDanielGavin <danielgavin5@hotmail.com>2020-11-20 13:44:56 +0100
commitcf0daf3537ceade3c1be451136f093188c0410eb (patch)
treec72f3c947458ee99d373218126429323f14a1469 /src
parent1d985964d24f3f4ec6fe8f003b2a3b5e61fd8297 (diff)
get the function parameters into local
Diffstat (limited to 'src')
-rw-r--r--src/server/analysis.odin27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin
index ad0d50f..dbfe076 100644
--- a/src/server/analysis.odin
+++ b/src/server/analysis.odin
@@ -638,7 +638,8 @@ resolve_type_identifier :: proc(ast_context: ^AstContext, node: ast.Ident, expec
else if node.name == "int" || node.name == "string"
|| node.name == "u64" || node.name == "f32"
|| node.name == "i64" || node.name == "i32"
- || node.name == "bool" || node.name == "rawptr" {
+ || node.name == "bool" || node.name == "rawptr"
+ || node.name == "any" {
symbol := index.Symbol {
type = .Keyword,
@@ -865,6 +866,7 @@ get_locals_value_decl :: proc(file: ast.File, value_decl: ast.Value_Decl, ast_co
case Comp_Lit:
append(&results, v.type);
case:
+ log.debugf("default node get_locals_value_decl %v", v);
append(&results, value);
}
@@ -888,10 +890,18 @@ get_locals_stmt :: proc(file: ast.File, stmt: ^ast.Stmt, ast_context: ^AstContex
switch v in stmt.derived {
case Value_Decl:
get_locals_value_decl(file, v, ast_context);
+ case Type_Switch_Stmt:
+ get_locals_type_switch_stmt(file, v, ast_context);
+ case:
+ log.debugf("default node local stmt %v", v);
}
}
+get_locals_type_switch_stmt :: proc(file: ast.File, stmt: ast.Type_Switch_Stmt, ast_context: ^AstContext) {
+
+}
+
get_locals :: proc(file: ast.File, function: ^ast.Node, ast_context: ^AstContext) {
proc_lit, ok := function.derived.(ast.Proc_Lit);
@@ -900,6 +910,21 @@ get_locals :: proc(file: ast.File, function: ^ast.Node, ast_context: ^AstContext
return;
}
+ if proc_lit.type != nil && proc_lit.type.params != nil {
+
+ for arg in proc_lit.type.params.list {
+
+ for name in arg.names {
+ if arg.type != nil {
+ str := common.get_ast_node_string(name, file.src);
+ ast_context.locals[str] = arg.type;
+ }
+ }
+
+ }
+
+ }
+
block: ast.Block_Stmt;
block, ok = proc_lit.body.derived.(ast.Block_Stmt);