mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 01:40:46 +00:00
LibJS: Use Identifier to represent CatchClause parameter names
By doing that we consistently use Identifier node for identifiers and also enable mechanism that registers identifiers in a corresponding ScopePusher for catch parameters, which is necessary for work in the upcoming changes.
This commit is contained in:
parent
42f72bbdce
commit
0f14c70252
Notes:
github-actions[bot]
2025-04-22 19:58:36 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 0f14c70252
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4421
Reviewed-by: https://github.com/gmta
4 changed files with 43 additions and 30 deletions
|
@ -2075,7 +2075,7 @@ private:
|
|||
|
||||
class CatchClause final : public ASTNode {
|
||||
public:
|
||||
CatchClause(SourceRange source_range, FlyString parameter, NonnullRefPtr<BlockStatement const> body)
|
||||
CatchClause(SourceRange source_range, NonnullRefPtr<Identifier const> parameter, NonnullRefPtr<BlockStatement const> body)
|
||||
: ASTNode(move(source_range))
|
||||
, m_parameter(move(parameter))
|
||||
, m_body(move(body))
|
||||
|
@ -2089,13 +2089,20 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
CatchClause(SourceRange source_range, NonnullRefPtr<BlockStatement const> body)
|
||||
: ASTNode(move(source_range))
|
||||
, m_parameter(Empty {})
|
||||
, m_body(move(body))
|
||||
{
|
||||
}
|
||||
|
||||
auto& parameter() const { return m_parameter; }
|
||||
BlockStatement const& body() const { return m_body; }
|
||||
|
||||
virtual void dump(int indent) const override;
|
||||
|
||||
private:
|
||||
Variant<FlyString, NonnullRefPtr<BindingPattern const>> m_parameter;
|
||||
Variant<NonnullRefPtr<Identifier const>, NonnullRefPtr<BindingPattern const>, Empty> m_parameter;
|
||||
NonnullRefPtr<BlockStatement const> m_body;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue