1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:07:46 +00:00

LibJS: Use an enum class instead of 'bool is_generator'

This avoid confusion in the order of the multiple boolean parameters
that exist.
This commit is contained in:
Ali Mohammad Pur 2021-06-11 03:38:05 +04:30 committed by Ali Mohammad Pur
parent 5ffe23e4f3
commit 8b3f8879c1
9 changed files with 46 additions and 29 deletions

View file

@ -100,7 +100,7 @@ Value FunctionDeclaration::execute(Interpreter& interpreter, GlobalObject&) cons
Value FunctionExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
{
InterpreterNodeScope node_scope { interpreter, *this };
return ScriptFunction::create(global_object, name(), body(), parameters(), function_length(), interpreter.current_scope(), is_generator(), is_strict_mode() || interpreter.vm().in_strict_mode(), is_arrow_function());
return ScriptFunction::create(global_object, name(), body(), parameters(), function_length(), interpreter.current_scope(), kind(), is_strict_mode() || interpreter.vm().in_strict_mode(), is_arrow_function());
}
Value ExpressionStatement::execute(Interpreter& interpreter, GlobalObject& global_object) const
@ -1157,7 +1157,7 @@ void BindingPattern::dump(int indent) const
void FunctionNode::dump(int indent, String const& class_name) const
{
print_indent(indent);
outln("{}{} '{}'", class_name, m_is_generator ? "*" : "", name());
outln("{}{} '{}'", class_name, m_kind == FunctionKind::Generator ? "*" : "", name());
if (!m_parameters.is_empty()) {
print_indent(indent + 1);
outln("(Parameters)");