chore: format

This commit is contained in:
Ryan Chandler 2022-09-13 00:46:58 +01:00
parent c5e4632c15
commit ce49b01cca
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA

View File

@ -181,7 +181,7 @@ impl Parser {
self.semi()?;
Statement::Global { vars }
},
}
TokenKind::Static if matches!(self.peek.kind, TokenKind::Variable(_)) => {
self.next();
@ -3320,16 +3320,22 @@ mod tests {
#[test]
fn global_statements() {
assert_ast("<?php global $a;", &[
Statement::Global { vars: vec!["a".into()] }
]);
assert_ast(
"<?php global $a;",
&[Statement::Global {
vars: vec!["a".into()],
}],
);
}
#[test]
fn multiple_global_vars_in_statement() {
assert_ast("<?php global $a, $b;", &[
Statement::Global { vars: vec!["a".into(), "b".into()] }
]);
assert_ast(
"<?php global $a, $b;",
&[Statement::Global {
vars: vec!["a".into(), "b".into()],
}],
);
}
fn assert_ast(source: &str, expected: &[Statement]) {