mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibJS: Add a bunch of fast_is<T> helpers for commonly checked types
Based on what was hitting dynamic_cast<T> on Speedometer.
This commit is contained in:
parent
c0cbd439a2
commit
84626c7db2
Notes:
github-actions[bot]
2025-04-18 12:48:02 +00:00
Author: https://github.com/awesomekling
Commit: 84626c7db2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4395
4 changed files with 41 additions and 1 deletions
|
@ -54,6 +54,7 @@ protected:
|
|||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
virtual bool is_promise() const override { return true; }
|
||||
bool is_settled() const { return m_state == State::Fulfilled || m_state == State::Rejected; }
|
||||
|
||||
void trigger_reactions() const;
|
||||
|
@ -66,4 +67,7 @@ private:
|
|||
bool m_is_handled { false }; // [[PromiseIsHandled]]
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Object::fast_is<Promise>() const { return is_promise(); }
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue