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. 3
      src/parser/tests.rs

1
src/parser/rules.rs

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

3
src/parser/tests.rs

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

Loading…
Cancel
Save