parser: support nullable types

This commit is contained in:
Ryan Chandler 2022-07-23 15:51:16 +01:00
parent 8e1b13f715
commit 13d0aa21cd
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
2 changed files with 9 additions and 0 deletions

View File

@ -2,4 +2,8 @@
function foo(string $bar) {
}
function bar(?string $baz) {
}

View File

@ -48,6 +48,11 @@ impl Parser {
self.next();
return Ok(t);
},
TokenKind::Question => {
self.next();
let t = self.type_string()?;
return Ok(Type::Nullable(Box::new(t)));
},
_ => todo!()
}
};