diff --git a/semantic/src/lib.rs b/semantic/src/lib.rs index 8dd6f97..3405a2e 100644 --- a/semantic/src/lib.rs +++ b/semantic/src/lib.rs @@ -11,27 +11,15 @@ pub fn walk_ast(top_scope: Arc, tl: &mut Vec) { match tl { parser::ast::TopLevel::Import(_) => unimplemented!(), - parser::ast::TopLevel::FunctionDecl { - export, - name, - params, - return_type, - body, - } => { + parser::ast::TopLevel::FunctionDecl { params, body, .. } => { let scope = LocalScope::new(top_scope.clone()); scope.with_params(params); scope.with_block(body); - - println!("{:?}", scope); } - parser::ast::TopLevel::StructDecl { - export, - name, - fields, - } => {} + parser::ast::TopLevel::StructDecl { .. } => {} } } } diff --git a/semantic/src/scope.rs b/semantic/src/scope.rs index 4c48f4c..a2f4ac6 100644 --- a/semantic/src/scope.rs +++ b/semantic/src/scope.rs @@ -92,6 +92,13 @@ impl LocalScope { } _ => unimplemented!(), }, + Postfix::Call(_args) => match &*current_type { + TypeRef::Function(s) => { + // TODO: arg checking + current_type = s.return_type.clone()?; + } + _ => unimplemented!(), + }, _ => unimplemented!(), } } diff --git a/test/src/main.ms b/test/src/main.ms index d2f6e1a..5b271de 100644 --- a/test/src/main.ms +++ b/test/src/main.ms @@ -3,7 +3,7 @@ struct Test { } function add() { - let output = test().x; + let output = test(); } -function test(): Test { } \ No newline at end of file +function test(): int { } \ No newline at end of file