Skip to content

Commit

Permalink
🐛 Fix function calls
Browse files Browse the repository at this point in the history
semver: patch
  • Loading branch information
Somfic committed Jan 1, 2025
1 parent d8087f0 commit c3375d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/parser/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub fn parse<'de>(
pub fn call<'de>(
parser: &mut Parser<'de>,
lhs: Expression<'de>,
binding_power: BindingPower,
_binding_power: BindingPower,
) -> Result<Expression<'de>> {
let mut arguments = Vec::new();

Expand All @@ -92,7 +92,7 @@ pub fn call<'de>(
.expect(TokenKind::Comma, "expected a comma between arguments")?;
}

let argument = parse(parser, binding_power.clone())?;
let argument = parse(parser, BindingPower::None)?;
arguments.push(argument);
}

Expand Down
4 changes: 2 additions & 2 deletions src/parser/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ impl Default for Lookup<'_> {
.add_expression_handler(TokenKind::String, expression::primitive::string)
.add_expression_handler(TokenKind::Identifier, expression::primitive::identifier)
.add_expression_handler(TokenKind::ParenOpen, group)
.add_left_expression_handler(TokenKind::If, BindingPower::None, conditional)
.add_left_expression_handler(TokenKind::ParenOpen, BindingPower::None, expression::call)
.add_left_expression_handler(TokenKind::If, BindingPower::Logical, conditional)
.add_left_expression_handler(TokenKind::ParenOpen, BindingPower::Call, expression::call)
.add_expression_handler(TokenKind::Not, expression::unary::negate)
.add_expression_handler(TokenKind::Minus, expression::unary::negative)
.add_expression_handler(TokenKind::CurlyOpen, block)
Expand Down
2 changes: 0 additions & 2 deletions src/parser/typechecker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ impl<'ast> TypeChecker<'ast> {
Ok(truthy)
}
untyped::ExpressionValue::Call { callee, arguments } => {
println!("callee: {:?}", callee);
let callee = self.type_of(callee, environment)?;
println!("callee: {:?}", callee);

match callee.clone().value {
TypeValue::Function {
Expand Down

0 comments on commit c3375d8

Please sign in to comment.