mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
LibWeb: Introduce and use ComponentValue::is_delim() helper
`foo.is(Token::Type::Delim) && foo.token().delim() == '!'` becomes `foo.is_delim('!')`, which is a lot less verbose. I really should have done this ages ago.
This commit is contained in:
parent
bf242efd1d
commit
57a247530c
2 changed files with 24 additions and 31 deletions
|
@ -31,6 +31,7 @@ public:
|
|||
|
||||
bool is_token() const { return m_value.has<Token>(); }
|
||||
bool is(Token::Type type) const { return is_token() && token().is(type); }
|
||||
bool is_delim(u32 delim) const { return is(Token::Type::Delim) && token().delim() == delim; }
|
||||
Token const& token() const { return m_value.get<Token>(); }
|
||||
operator Token() const { return m_value.get<Token>(); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue