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 { 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(), actual: child.kind().to_string(),
location: child.start_position(), location: child.start_position(),
relevant_source: source[child.byte_range()].to_string(), 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 r#type = Type::function(parameter_types, return_type.take_inner());
let syntax_position = node.range().into(); let syntax_position = node.range().into();
println!("{context}");
Ok(FunctionNode { Ok(FunctionNode {
parameters, parameters,
body, body,

View File

@ -50,6 +50,8 @@ impl AbstractTree for Identifier {
fn expected_type(&self, context: &Map) -> Result<Type> { fn expected_type(&self, context: &Map) -> Result<Type> {
if let Some((_value, r#type)) = context.variables()?.get(&self.0) { if let Some((_value, r#type)) = context.variables()?.get(&self.0) {
println!("{_value} {}", r#type);
Ok(r#type.clone()) Ok(r#type.clone())
} else { } else {
Err(Error::VariableIdentifierNotFound(self.0.clone())) Err(Error::VariableIdentifierNotFound(self.0.clone()))

View File

@ -157,10 +157,10 @@ pub enum Error {
actual: Value, 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), 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), FunctionIdentifierNotFound(String),
/// The function failed due to an external error. /// The function failed due to an external error.