1
0
This commit is contained in:
Jeff 2024-01-22 20:45:46 -05:00
parent 7642b23553
commit 1ae9dd67a7
4 changed files with 7 additions and 3 deletions

View File

@ -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(),

View File

@ -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,

View File

@ -50,6 +50,8 @@ impl AbstractTree for Identifier {
fn expected_type(&self, context: &Map) -> Result<Type> {
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()))

View File

@ -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.