From 2a7988f9a6e39d7f8e9cf958b8d47976289e2019 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 4 Jan 2024 21:12:45 -0500 Subject: [PATCH] Implement structures --- examples/map.ds | 6 +++--- src/abstract_tree/function_call.rs | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/examples/map.ds b/examples/map.ds index 568d413..39cb55e 100644 --- a/examples/map.ds +++ b/examples/map.ds @@ -1,11 +1,11 @@ -dictionary = { +Info = struct { dust = "awesome" answer = 42 } output( 'Dust is ' - + dictionary:dust + + Info:dust + '! The answer is ' - + dictionary:answer + + Info:answer ) diff --git a/src/abstract_tree/function_call.rs b/src/abstract_tree/function_call.rs index 31b5748..e07355a 100644 --- a/src/abstract_tree/function_call.rs +++ b/src/abstract_tree/function_call.rs @@ -51,17 +51,14 @@ impl AbstractTree for FunctionCall { let get_type = variables.get(identifier.inner()); if let Some((_, r#type)) = get_type { - r#type + r#type.clone() } else { return Err(Error::FunctionIdentifierNotFound( identifier.inner().clone(), )); } } - FunctionExpression::FunctionCall(_) => todo!(), - FunctionExpression::Value(_) => todo!(), - FunctionExpression::Index(_) => todo!(), - FunctionExpression::Yield(_) => todo!(), + function_expression => function_expression.expected_type(context)?, }; let parameter_types = if let Type::Function { parameter_types, ..