mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 07:07:49 +00:00
LibJS: Make generate_labelled_evaluation
non-virtual if possible
We don't override anything with definitions of this function in `SwitchStatement` and `LabelledStatement`. Also, we can make the `IterationStatement` abstract, there is no need to add a fallback error-generating stub implementation of this method.
This commit is contained in:
parent
6b08a52c8b
commit
456d750539
Notes:
github-actions[bot]
2025-05-12 17:41:52 +00:00
Author: https://github.com/BertalanD
Commit: 456d750539
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4703
Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 5 additions and 13 deletions
|
@ -193,7 +193,7 @@ public:
|
|||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode(Bytecode::Generator&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
|
||||
FlyString const& label() const { return m_label; }
|
||||
FlyString& label() { return m_label; }
|
||||
|
@ -221,7 +221,7 @@ class IterationStatement : public Statement {
|
|||
public:
|
||||
using Statement::Statement;
|
||||
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const = 0;
|
||||
|
||||
private:
|
||||
virtual bool is_iteration_statement() const final { return true; }
|
||||
|
@ -869,7 +869,7 @@ public:
|
|||
virtual void dump(int indent) const override;
|
||||
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode(Bytecode::Generator&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode_with_lhs_name(Bytecode::Generator&, Optional<Bytecode::IdentifierTableIndex> lhs_name, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode_with_lhs_name(Bytecode::Generator&, Optional<Bytecode::IdentifierTableIndex> lhs_name, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
|
||||
bool has_name() const override { return !name().is_empty(); }
|
||||
|
||||
|
@ -1513,7 +1513,7 @@ public:
|
|||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode(Bytecode::Generator&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode_with_lhs_name(Bytecode::Generator&, Optional<Bytecode::IdentifierTableIndex> lhs_name, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode_with_lhs_name(Bytecode::Generator&, Optional<Bytecode::IdentifierTableIndex> lhs_name, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
|
||||
bool has_name() const { return m_name; }
|
||||
|
||||
|
@ -2208,7 +2208,7 @@ public:
|
|||
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_bytecode(Bytecode::Generator&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const override;
|
||||
virtual Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
Bytecode::CodeGenerationErrorOr<Optional<Bytecode::ScopedOperand>> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&, Optional<Bytecode::ScopedOperand> preferred_dst = {}) const;
|
||||
|
||||
void add_case(NonnullRefPtr<SwitchCase const> switch_case) { m_cases.append(move(switch_case)); }
|
||||
|
||||
|
|
|
@ -873,14 +873,6 @@ Bytecode::CodeGenerationErrorOr<Optional<ScopedOperand>> LabelledStatement::gene
|
|||
return stmt_result;
|
||||
}
|
||||
|
||||
Bytecode::CodeGenerationErrorOr<Optional<ScopedOperand>> IterationStatement::generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&, [[maybe_unused]] Optional<ScopedOperand> preferred_dst) const
|
||||
{
|
||||
return Bytecode::CodeGenerationError {
|
||||
this,
|
||||
"Missing generate_labelled_evaluation()"sv,
|
||||
};
|
||||
}
|
||||
|
||||
Bytecode::CodeGenerationErrorOr<Optional<ScopedOperand>> WhileStatement::generate_bytecode(Bytecode::Generator& generator, [[maybe_unused]] Optional<ScopedOperand> preferred_dst) const
|
||||
{
|
||||
Bytecode::Generator::SourceLocationScope scope(generator, *this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue