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(_) => { 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));
} }

3
src/parser/tests.rs

@ -607,14 +607,15 @@ 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 = "
fn main() {
if n > 2 { if n > 2 {
_printf(true) _printf(true)
} else { } else {
_printf(true) _printf(true)
} }
}
"; ";
let tokens = tokenize(raw); let tokens = tokenize(raw);
let tree = parse(tokens, Some(raw.to_string())); let tree = parse(tokens, Some(raw.to_string()));

Loading…
Cancel
Save