diff --git a/src/abstract_tree/function_expression.rs b/src/abstract_tree/function_expression.rs index 3d01da5..8e2ced9 100644 --- a/src/abstract_tree/function_expression.rs +++ b/src/abstract_tree/function_expression.rs @@ -40,7 +40,7 @@ impl AbstractTree for FunctionExpression { } _ => { return Err(Error::UnexpectedSyntaxNode { - expected: "identifier, function call, value or index".to_string(), + expected: "identifier, function call, value, index or yield".to_string(), actual: child.kind().to_string(), location: child.start_position(), relevant_source: source[child.byte_range()].to_string(), diff --git a/src/abstract_tree/function_node.rs b/src/abstract_tree/function_node.rs index ca38adc..0030b76 100644 --- a/src/abstract_tree/function_node.rs +++ b/src/abstract_tree/function_node.rs @@ -112,6 +112,8 @@ impl AbstractTree for FunctionNode { let r#type = Type::function(parameter_types, return_type.take_inner()); let syntax_position = node.range().into(); + println!("{context}"); + Ok(FunctionNode { parameters, body, diff --git a/src/abstract_tree/identifier.rs b/src/abstract_tree/identifier.rs index a4a58ef..78aa223 100644 --- a/src/abstract_tree/identifier.rs +++ b/src/abstract_tree/identifier.rs @@ -50,6 +50,8 @@ impl AbstractTree for Identifier { fn expected_type(&self, context: &Map) -> Result { if let Some((_value, r#type)) = context.variables()?.get(&self.0) { + println!("{_value} {}", r#type); + Ok(r#type.clone()) } else { Err(Error::VariableIdentifierNotFound(self.0.clone())) diff --git a/src/error.rs b/src/error.rs index 73cb9a8..3c85f26 100644 --- a/src/error.rs +++ b/src/error.rs @@ -157,10 +157,10 @@ pub enum Error { actual: Value, }, - /// A `VariableIdentifier` operation did not find its value in the context. + /// Failed to find a variable with a value for this key. VariableIdentifierNotFound(String), - /// A `FunctionIdentifier` operation did not find its value in the context. + /// Failed to find a variable with a function value for this key. FunctionIdentifierNotFound(String), /// The function failed due to an external error.