Browse Source

Fix booleans in functions calls

github-actions v0.0.4
Garrit Franke 3 years ago
parent
commit
6ff65ea610
  1. 1
      src/parser/rules.rs
  2. 11
      src/parser/tests.rs

1
src/parser/rules.rs

@ -174,6 +174,7 @@ impl Parser {
TokenKind::Identifier(_) | TokenKind::Literal(_) => { TokenKind::Identifier(_) | TokenKind::Literal(_) => {
args.push(self.parse_expression()?) args.push(self.parse_expression()?)
} }
TokenKind::Keyword(Keyword::Boolean) => args.push(self.parse_expression()?),
_ => { _ => {
return Err(self.make_error(TokenKind::BraceClose, next)); return Err(self.make_error(TokenKind::BraceClose, next));
} }

11
src/parser/tests.rs

@ -607,13 +607,14 @@ fn test_function_with_return_type() {
} }
#[test] #[test]
#[ignore]
fn test_booleans_in_function_call() { fn test_booleans_in_function_call() {
let raw = " let raw = "
if n > 2 { fn main() {
_printf(true) if n > 2 {
} else { _printf(true)
_printf(true) } else {
_printf(true)
}
} }
"; ";
let tokens = tokenize(raw); let tokens = tokenize(raw);

Loading…
Cancel
Save