diff --git a/dust-lang/src/parse.rs b/dust-lang/src/parse.rs index bb1844e..2437146 100644 --- a/dust-lang/src/parse.rs +++ b/dust-lang/src/parse.rs @@ -256,26 +256,8 @@ impl<'src> Parser<'src> { (Token::IsEven, left_span) => { self.next_token()?; - let mut value_parameters = None; - if let (Token::LeftParenthesis, _) = self.current { self.next_token()?; - - value_parameters = Some(vec![self.parse_node(0)?]); - - loop { - self.next_token()?; - - if let (Token::RightParenthesis, _) = self.current { - break; - } - - if let (Token::Comma, _) = self.current { - self.next_token()?; - } - - value_parameters.as_mut().unwrap().push(self.parse_node(0)?); - } } else { return Err(ParseError::ExpectedOpeningParenthesis { actual: self.current.0.clone(), @@ -296,7 +278,7 @@ impl<'src> Parser<'src> { Statement::BuiltInFunctionCall { function: BuiltInFunction::IsEven, type_arguments: None, - value_arguments: value_parameters, + value_arguments: None, }, left_span, )) diff --git a/dust-lang/src/vm.rs b/dust-lang/src/vm.rs index 8bf82e2..5d3c76f 100644 --- a/dust-lang/src/vm.rs +++ b/dust-lang/src/vm.rs @@ -213,13 +213,11 @@ impl Vm

{ }, ) = (left_value, right.statement) { - if let Some(mut nodes) = value_argument_nodes.take() { - nodes.insert(0, Node::new(Statement::Constant(value), right_span)); - } + let mut value_arguments = Vec::new(); - let value_arguments = if let Some(value_nodes) = value_argument_nodes { - let mut value_arguments = Vec::new(); + value_arguments.push(value); + if let Some(value_nodes) = value_argument_nodes { for node in value_nodes { let position = node.position; let value = if let Some(value) = self.run_node(node, variables)? { @@ -230,13 +228,9 @@ impl Vm

{ value_arguments.push(value); } + } - Some(value_arguments) - } else { - None - }; - - let function_call_return = function.call(None, value_arguments)?; + let function_call_return = function.call(None, Some(value_arguments))?; return Ok(Some(function_call_return)); }