mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -1955,7 +1955,7 @@ void ScopeNode::dump(int indent) const
|
|||
|
||||
void BinaryExpression::dump(int indent) const
|
||||
{
|
||||
const char* op_string = nullptr;
|
||||
char const* op_string = nullptr;
|
||||
switch (m_op) {
|
||||
case BinaryOp::Addition:
|
||||
op_string = "+";
|
||||
|
@ -2035,7 +2035,7 @@ void BinaryExpression::dump(int indent) const
|
|||
|
||||
void LogicalExpression::dump(int indent) const
|
||||
{
|
||||
const char* op_string = nullptr;
|
||||
char const* op_string = nullptr;
|
||||
switch (m_op) {
|
||||
case LogicalOp::And:
|
||||
op_string = "&&";
|
||||
|
@ -2058,7 +2058,7 @@ void LogicalExpression::dump(int indent) const
|
|||
|
||||
void UnaryExpression::dump(int indent) const
|
||||
{
|
||||
const char* op_string = nullptr;
|
||||
char const* op_string = nullptr;
|
||||
switch (m_op) {
|
||||
case UnaryOp::BitwiseNot:
|
||||
op_string = "~";
|
||||
|
@ -2153,7 +2153,7 @@ void ClassMethod::dump(int indent) const
|
|||
outln("(Key)");
|
||||
m_key->dump(indent + 1);
|
||||
|
||||
const char* kind_string = nullptr;
|
||||
char const* kind_string = nullptr;
|
||||
switch (m_kind) {
|
||||
case Kind::Method:
|
||||
kind_string = "Method";
|
||||
|
@ -2346,7 +2346,7 @@ void FunctionDeclaration::dump(int indent) const
|
|||
FunctionNode::dump(indent, class_name());
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<const FlyString&>&& callback) const
|
||||
ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const
|
||||
{
|
||||
if (name().is_empty())
|
||||
return {};
|
||||
|
@ -2757,7 +2757,7 @@ Completion UpdateExpression::execute(Interpreter& interpreter, GlobalObject& glo
|
|||
|
||||
void AssignmentExpression::dump(int indent) const
|
||||
{
|
||||
const char* op_string = nullptr;
|
||||
char const* op_string = nullptr;
|
||||
switch (m_op) {
|
||||
case AssignmentOp::Assignment:
|
||||
op_string = "=";
|
||||
|
@ -2818,7 +2818,7 @@ void AssignmentExpression::dump(int indent) const
|
|||
|
||||
void UpdateExpression::dump(int indent) const
|
||||
{
|
||||
const char* op_string = nullptr;
|
||||
char const* op_string = nullptr;
|
||||
switch (m_op) {
|
||||
case UpdateOp::Increment:
|
||||
op_string = "++";
|
||||
|
@ -2903,7 +2903,7 @@ ThrowCompletionOr<void> VariableDeclaration::for_each_bound_name(ThrowCompletion
|
|||
|
||||
void VariableDeclaration::dump(int indent) const
|
||||
{
|
||||
const char* declaration_kind_string = nullptr;
|
||||
char const* declaration_kind_string = nullptr;
|
||||
switch (m_declaration_kind) {
|
||||
case DeclarationKind::Let:
|
||||
declaration_kind_string = "Let";
|
||||
|
@ -2927,7 +2927,7 @@ void VariableDeclaration::dump(int indent) const
|
|||
void VariableDeclarator::dump(int indent) const
|
||||
{
|
||||
ASTNode::dump(indent);
|
||||
m_target.visit([indent](const auto& value) { value->dump(indent + 1); });
|
||||
m_target.visit([indent](auto const& value) { value->dump(indent + 1); });
|
||||
if (m_init)
|
||||
m_init->dump(indent + 1);
|
||||
}
|
||||
|
|
|
@ -190,8 +190,8 @@ concept ThrowCompletionOrVoidFunction = requires(Func func, Args... args)
|
|||
{
|
||||
{
|
||||
func(args...)
|
||||
}
|
||||
->SameAs<ThrowCompletionOr<void>>;
|
||||
}
|
||||
-> SameAs<ThrowCompletionOr<void>>;
|
||||
};
|
||||
|
||||
template<typename... Args>
|
||||
|
|
|
@ -1216,7 +1216,7 @@ Bytecode::CodeGenerationErrorOr<void> CallExpression::generate_bytecode(Bytecode
|
|||
"Unimplemented callee kind: SuperExpression"sv,
|
||||
};
|
||||
} else if (is<MemberExpression>(*m_callee)) {
|
||||
auto& member_expression = static_cast<const MemberExpression&>(*m_callee);
|
||||
auto& member_expression = static_cast<MemberExpression const&>(*m_callee);
|
||||
if (is<SuperExpression>(member_expression.object())) {
|
||||
return Bytecode::CodeGenerationError {
|
||||
this,
|
||||
|
|
|
@ -794,7 +794,7 @@ String NewArray::to_string_impl(Bytecode::Executable const&) const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
String IteratorToArray::to_string_impl(const Bytecode::Executable&) const
|
||||
String IteratorToArray::to_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "IteratorToArray";
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ String NewRegExp::to_string_impl(Bytecode::Executable const& executable) const
|
|||
return String::formatted("NewRegExp source:{} (\"{}\") flags:{} (\"{}\")", m_source_index, executable.get_string(m_source_index), m_flags_index, executable.get_string(m_flags_index));
|
||||
}
|
||||
|
||||
String CopyObjectExcludingProperties::to_string_impl(const Bytecode::Executable&) const
|
||||
String CopyObjectExcludingProperties::to_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.appendff("CopyObjectExcludingProperties from:{}", m_from_object);
|
||||
|
@ -859,7 +859,7 @@ String CreateVariable::to_string_impl(Bytecode::Executable const& executable) co
|
|||
return String::formatted("CreateVariable env:{} immutable:{} {} ({})", mode_string, m_is_immutable, m_identifier, executable.identifier_table->get(m_identifier));
|
||||
}
|
||||
|
||||
String EnterObjectEnvironment::to_string_impl(const Executable&) const
|
||||
String EnterObjectEnvironment::to_string_impl(Executable const&) const
|
||||
{
|
||||
return String::formatted("EnterObjectEnvironment");
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ String EnterUnwindContext::to_string_impl(Bytecode::Executable const&) const
|
|||
return String::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point);
|
||||
}
|
||||
|
||||
String FinishUnwind::to_string_impl(const Bytecode::Executable&) const
|
||||
String FinishUnwind::to_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return String::formatted("FinishUnwind next:{}", m_next_target);
|
||||
}
|
||||
|
@ -998,7 +998,7 @@ String ContinuePendingUnwind::to_string_impl(Bytecode::Executable const&) const
|
|||
return String::formatted("ContinuePendingUnwind resume:{}", m_resume_target);
|
||||
}
|
||||
|
||||
String PushDeclarativeEnvironment::to_string_impl(const Bytecode::Executable& executable) const
|
||||
String PushDeclarativeEnvironment::to_string_impl(Bytecode::Executable const& executable) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("PushDeclarativeEnvironment");
|
||||
|
@ -1020,12 +1020,12 @@ String Yield::to_string_impl(Bytecode::Executable const&) const
|
|||
return String::formatted("Yield return");
|
||||
}
|
||||
|
||||
String GetByValue::to_string_impl(const Bytecode::Executable&) const
|
||||
String GetByValue::to_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return String::formatted("GetByValue base:{}", m_base);
|
||||
}
|
||||
|
||||
String PutByValue::to_string_impl(const Bytecode::Executable&) const
|
||||
String PutByValue::to_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto kind = m_kind == PropertyKind::Getter
|
||||
? "getter"
|
||||
|
@ -1046,7 +1046,7 @@ String GetIterator::to_string_impl(Executable const&) const
|
|||
return "GetIterator";
|
||||
}
|
||||
|
||||
String GetObjectPropertyIterator::to_string_impl(const Bytecode::Executable&) const
|
||||
String GetObjectPropertyIterator::to_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "GetObjectPropertyIterator";
|
||||
}
|
||||
|
|
|
@ -58,13 +58,13 @@ public:
|
|||
void set_client(ConsoleClient& client) { m_client = &client; }
|
||||
|
||||
GlobalObject& global_object() { return m_global_object; }
|
||||
const GlobalObject& global_object() const { return m_global_object; }
|
||||
GlobalObject const& global_object() const { return m_global_object; }
|
||||
|
||||
VM& vm();
|
||||
Vector<Value> vm_arguments();
|
||||
|
||||
HashMap<String, unsigned>& counters() { return m_counters; }
|
||||
const HashMap<String, unsigned>& counters() const { return m_counters; }
|
||||
HashMap<String, unsigned> const& counters() const { return m_counters; }
|
||||
|
||||
ThrowCompletionOr<Value> debug();
|
||||
ThrowCompletionOr<Value> error();
|
||||
|
@ -119,7 +119,7 @@ protected:
|
|||
VM& vm();
|
||||
|
||||
GlobalObject& global_object() { return m_console.global_object(); }
|
||||
const GlobalObject& global_object() const { return m_console.global_object(); }
|
||||
GlobalObject const& global_object() const { return m_console.global_object(); }
|
||||
|
||||
Console& m_console;
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
~HandleImpl();
|
||||
|
||||
Cell* cell() { return m_cell; }
|
||||
const Cell* cell() const { return m_cell; }
|
||||
Cell const* cell() const { return m_cell; }
|
||||
|
||||
private:
|
||||
template<class T>
|
||||
|
|
|
@ -156,15 +156,15 @@ __attribute__((no_sanitize("address"))) void Heap::gather_conservative_roots(Has
|
|||
for (auto possible_pointer : possible_pointers) {
|
||||
if (!possible_pointer)
|
||||
continue;
|
||||
dbgln_if(HEAP_DEBUG, " ? {}", (const void*)possible_pointer);
|
||||
auto* possible_heap_block = HeapBlock::from_cell(reinterpret_cast<const Cell*>(possible_pointer));
|
||||
dbgln_if(HEAP_DEBUG, " ? {}", (void const*)possible_pointer);
|
||||
auto* possible_heap_block = HeapBlock::from_cell(reinterpret_cast<Cell const*>(possible_pointer));
|
||||
if (all_live_heap_blocks.contains(possible_heap_block)) {
|
||||
if (auto* cell = possible_heap_block->cell_from_possible_pointer(possible_pointer)) {
|
||||
if (cell->state() == Cell::State::Live) {
|
||||
dbgln_if(HEAP_DEBUG, " ?-> {}", (const void*)cell);
|
||||
dbgln_if(HEAP_DEBUG, " ?-> {}", (void const*)cell);
|
||||
roots.set(cell);
|
||||
} else {
|
||||
dbgln_if(HEAP_DEBUG, " #-> {}", (const void*)cell);
|
||||
dbgln_if(HEAP_DEBUG, " #-> {}", (void const*)cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void Heap::mark_live_cells(const HashTable<Cell*>& roots)
|
||||
void Heap::mark_live_cells(HashTable<Cell*> const& roots)
|
||||
{
|
||||
dbgln_if(HEAP_DEBUG, "mark_live_cells:");
|
||||
|
||||
|
@ -200,7 +200,7 @@ void Heap::mark_live_cells(const HashTable<Cell*>& roots)
|
|||
m_uprooted_cells.clear();
|
||||
}
|
||||
|
||||
void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measurement_timer)
|
||||
void Heap::sweep_dead_cells(bool print_report, Core::ElapsedTimer const& measurement_timer)
|
||||
{
|
||||
dbgln_if(HEAP_DEBUG, "sweep_dead_cells:");
|
||||
Vector<HeapBlock*, 32> empty_blocks;
|
||||
|
|
|
@ -84,8 +84,8 @@ private:
|
|||
|
||||
void gather_roots(HashTable<Cell*>&);
|
||||
void gather_conservative_roots(HashTable<Cell*>&);
|
||||
void mark_live_cells(const HashTable<Cell*>& live_cells);
|
||||
void sweep_dead_cells(bool print_report, const Core::ElapsedTimer&);
|
||||
void mark_live_cells(HashTable<Cell*> const& live_cells);
|
||||
void sweep_dead_cells(bool print_report, Core::ElapsedTimer const&);
|
||||
|
||||
CellAllocator& allocator_for_size(size_t);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
Heap& heap() { return m_heap; }
|
||||
|
||||
static HeapBlock* from_cell(const Cell* cell)
|
||||
static HeapBlock* from_cell(Cell const* cell)
|
||||
{
|
||||
return reinterpret_cast<HeapBlock*>((FlatPtr)cell & ~(block_size - 1));
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public:
|
|||
return cell(cell_index);
|
||||
}
|
||||
|
||||
bool is_valid_cell_pointer(const Cell* cell)
|
||||
bool is_valid_cell_pointer(Cell const* cell)
|
||||
{
|
||||
return cell_from_possible_pointer((FlatPtr)cell);
|
||||
}
|
||||
|
|
|
@ -148,9 +148,9 @@ GlobalObject& Interpreter::global_object()
|
|||
return static_cast<GlobalObject&>(*m_global_object.cell());
|
||||
}
|
||||
|
||||
const GlobalObject& Interpreter::global_object() const
|
||||
GlobalObject const& Interpreter::global_object() const
|
||||
{
|
||||
return static_cast<const GlobalObject&>(*m_global_object.cell());
|
||||
return static_cast<GlobalObject const&>(*m_global_object.cell());
|
||||
}
|
||||
|
||||
Realm& Interpreter::realm()
|
||||
|
@ -158,9 +158,9 @@ Realm& Interpreter::realm()
|
|||
return static_cast<Realm&>(*m_realm.cell());
|
||||
}
|
||||
|
||||
const Realm& Interpreter::realm() const
|
||||
Realm const& Interpreter::realm() const
|
||||
{
|
||||
return static_cast<const Realm&>(*m_realm.cell());
|
||||
return static_cast<Realm const&>(*m_realm.cell());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace JS {
|
|||
|
||||
struct ExecutingASTNodeChain {
|
||||
ExecutingASTNodeChain* previous { nullptr };
|
||||
const ASTNode& node;
|
||||
ASTNode const& node;
|
||||
};
|
||||
|
||||
class Interpreter : public Weakable<Interpreter> {
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
ThrowCompletionOr<Value> run(SourceTextModule&);
|
||||
|
||||
GlobalObject& global_object();
|
||||
const GlobalObject& global_object() const;
|
||||
GlobalObject const& global_object() const;
|
||||
|
||||
Realm& realm();
|
||||
Realm const& realm() const;
|
||||
|
@ -130,7 +130,7 @@ public:
|
|||
m_ast_node_chain = m_ast_node_chain->previous;
|
||||
}
|
||||
|
||||
const ASTNode* current_node() const { return m_ast_node_chain ? &m_ast_node_chain->node : nullptr; }
|
||||
ASTNode const* current_node() const { return m_ast_node_chain ? &m_ast_node_chain->node : nullptr; }
|
||||
|
||||
private:
|
||||
explicit Interpreter(VM&);
|
||||
|
|
|
@ -64,7 +64,7 @@ void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, Has
|
|||
if (value.is_object()) {
|
||||
auto& object = value.as_object();
|
||||
if (is<Array>(object))
|
||||
return array_to_html(static_cast<const Array&>(object), output_html, seen_objects);
|
||||
return array_to_html(static_cast<Array const&>(object), output_html, seen_objects);
|
||||
output_html.append(wrap_string_in_style(object.class_name(), StyleType::ObjectType));
|
||||
if (object.is_function())
|
||||
return function_to_html(object, output_html, seen_objects);
|
||||
|
@ -91,7 +91,7 @@ void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, Has
|
|||
output_html.append("</span>");
|
||||
}
|
||||
|
||||
void MarkupGenerator::array_to_html(const Array& array, StringBuilder& html_output, HashTable<Object*>& seen_objects)
|
||||
void MarkupGenerator::array_to_html(Array const& array, StringBuilder& html_output, HashTable<Object*>& seen_objects)
|
||||
{
|
||||
html_output.append(wrap_string_in_style("[ ", StyleType::Punctuation));
|
||||
bool first = true;
|
||||
|
@ -105,7 +105,7 @@ void MarkupGenerator::array_to_html(const Array& array, StringBuilder& html_outp
|
|||
html_output.append(wrap_string_in_style(" ]", StyleType::Punctuation));
|
||||
}
|
||||
|
||||
void MarkupGenerator::object_to_html(const Object& object, StringBuilder& html_output, HashTable<Object*>& seen_objects)
|
||||
void MarkupGenerator::object_to_html(Object const& object, StringBuilder& html_output, HashTable<Object*>& seen_objects)
|
||||
{
|
||||
html_output.append(wrap_string_in_style("{ ", StyleType::Punctuation));
|
||||
bool first = true;
|
||||
|
@ -135,17 +135,17 @@ void MarkupGenerator::object_to_html(const Object& object, StringBuilder& html_o
|
|||
html_output.append(wrap_string_in_style(" }", StyleType::Punctuation));
|
||||
}
|
||||
|
||||
void MarkupGenerator::function_to_html(const Object& function, StringBuilder& html_output, HashTable<Object*>&)
|
||||
void MarkupGenerator::function_to_html(Object const& function, StringBuilder& html_output, HashTable<Object*>&)
|
||||
{
|
||||
html_output.appendff("[{}]", function.class_name());
|
||||
}
|
||||
|
||||
void MarkupGenerator::date_to_html(const Object& date, StringBuilder& html_output, HashTable<Object*>&)
|
||||
void MarkupGenerator::date_to_html(Object const& date, StringBuilder& html_output, HashTable<Object*>&)
|
||||
{
|
||||
html_output.appendff("Date {}", JS::to_date_string(static_cast<JS::Date const&>(date).date_value()));
|
||||
}
|
||||
|
||||
void MarkupGenerator::error_to_html(const Object& object, StringBuilder& html_output, HashTable<Object*>&)
|
||||
void MarkupGenerator::error_to_html(Object const& object, StringBuilder& html_output, HashTable<Object*>&)
|
||||
{
|
||||
auto& vm = object.vm();
|
||||
auto name = object.get_without_side_effects(vm.names.name).value_or(JS::js_undefined());
|
||||
|
|
|
@ -33,11 +33,11 @@ private:
|
|||
};
|
||||
|
||||
static void value_to_html(Value, StringBuilder& output_html, HashTable<Object*> seen_objects = {});
|
||||
static void array_to_html(const Array&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void object_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void function_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void date_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void error_to_html(const Object&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void array_to_html(Array const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void object_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void function_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void date_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
static void error_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
|
||||
|
||||
static String style_from_style_type(StyleType);
|
||||
static StyleType style_type_for_token(Token);
|
||||
|
|
|
@ -1798,7 +1798,7 @@ NonnullRefPtr<ArrayExpression> Parser::parse_array_expression()
|
|||
return create_ast_node<ArrayExpression>({ m_state.current_token.filename(), rule_start.position(), position() }, move(elements));
|
||||
}
|
||||
|
||||
NonnullRefPtr<StringLiteral> Parser::parse_string_literal(const Token& token, bool in_template_literal)
|
||||
NonnullRefPtr<StringLiteral> Parser::parse_string_literal(Token const& token, bool in_template_literal)
|
||||
{
|
||||
auto rule_start = push_start();
|
||||
auto status = Token::StringValueStatus::Ok;
|
||||
|
@ -3919,7 +3919,7 @@ Token Parser::consume_and_validate_numeric_literal()
|
|||
return token;
|
||||
}
|
||||
|
||||
void Parser::expected(const char* what)
|
||||
void Parser::expected(char const* what)
|
||||
{
|
||||
auto message = m_state.current_token.message();
|
||||
if (message.is_empty())
|
||||
|
@ -3936,7 +3936,7 @@ Position Parser::position() const
|
|||
};
|
||||
}
|
||||
|
||||
bool Parser::try_parse_arrow_function_expression_failed_at_position(const Position& position) const
|
||||
bool Parser::try_parse_arrow_function_expression_failed_at_position(Position const& position) const
|
||||
{
|
||||
auto it = m_token_memoizations.find(position);
|
||||
if (it == m_token_memoizations.end())
|
||||
|
@ -3945,12 +3945,12 @@ bool Parser::try_parse_arrow_function_expression_failed_at_position(const Positi
|
|||
return (*it).value.try_parse_arrow_function_expression_failed;
|
||||
}
|
||||
|
||||
void Parser::set_try_parse_arrow_function_expression_failed_at_position(const Position& position, bool failed)
|
||||
void Parser::set_try_parse_arrow_function_expression_failed_at_position(Position const& position, bool failed)
|
||||
{
|
||||
m_token_memoizations.set(position, { failed });
|
||||
}
|
||||
|
||||
void Parser::syntax_error(const String& message, Optional<Position> position)
|
||||
void Parser::syntax_error(String const& message, Optional<Position> position)
|
||||
{
|
||||
if (!position.has_value())
|
||||
position = this->position();
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
NonnullRefPtr<RegExpLiteral> parse_regexp_literal();
|
||||
NonnullRefPtr<ObjectExpression> parse_object_expression();
|
||||
NonnullRefPtr<ArrayExpression> parse_array_expression();
|
||||
NonnullRefPtr<StringLiteral> parse_string_literal(const Token& token, bool in_template_literal = false);
|
||||
NonnullRefPtr<StringLiteral> parse_string_literal(Token const& token, bool in_template_literal = false);
|
||||
NonnullRefPtr<TemplateLiteral> parse_template_literal(bool is_tagged);
|
||||
ExpressionResult parse_secondary_expression(NonnullRefPtr<Expression>, int min_precedence, Associativity associate = Associativity::Right, ForbiddenTokens forbidden = {});
|
||||
NonnullRefPtr<Expression> parse_call_expression(NonnullRefPtr<Expression>);
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
return String::formatted("{} (line: {}, column: {})", message, position.value().line, position.value().column);
|
||||
}
|
||||
|
||||
String source_location_hint(StringView source, const char spacer = ' ', const char indicator = '^') const
|
||||
String source_location_hint(StringView source, char const spacer = ' ', char const indicator = '^') const
|
||||
{
|
||||
if (!position.has_value())
|
||||
return {};
|
||||
|
@ -187,7 +187,7 @@ public:
|
|||
};
|
||||
|
||||
bool has_errors() const { return m_state.errors.size(); }
|
||||
const Vector<Error>& errors() const { return m_state.errors; }
|
||||
Vector<Error> const& errors() const { return m_state.errors; }
|
||||
void print_errors(bool print_hint = true) const
|
||||
{
|
||||
for (auto& error : m_state.errors) {
|
||||
|
@ -229,8 +229,8 @@ private:
|
|||
bool is_private_identifier_valid() const;
|
||||
bool match(TokenType type) const;
|
||||
bool done() const;
|
||||
void expected(const char* what);
|
||||
void syntax_error(const String& message, Optional<Position> = {});
|
||||
void expected(char const* what);
|
||||
void syntax_error(String const& message, Optional<Position> = {});
|
||||
Token consume();
|
||||
Token consume_identifier();
|
||||
Token consume_identifier_reference();
|
||||
|
@ -248,8 +248,8 @@ private:
|
|||
|
||||
void check_identifier_name_for_assignment_validity(FlyString const&, bool force_strict = false);
|
||||
|
||||
bool try_parse_arrow_function_expression_failed_at_position(const Position&) const;
|
||||
void set_try_parse_arrow_function_expression_failed_at_position(const Position&, bool);
|
||||
bool try_parse_arrow_function_expression_failed_at_position(Position const&) const;
|
||||
void set_try_parse_arrow_function_expression_failed_at_position(Position const&, bool);
|
||||
|
||||
bool match_invalid_escaped_keyword() const;
|
||||
|
||||
|
@ -278,7 +278,7 @@ private:
|
|||
VERIFY(last.column == m_position.column);
|
||||
}
|
||||
|
||||
const Position& position() const { return m_position; }
|
||||
Position const& position() const { return m_position; }
|
||||
|
||||
private:
|
||||
Parser& m_parser;
|
||||
|
@ -316,12 +316,12 @@ private:
|
|||
|
||||
class PositionKeyTraits {
|
||||
public:
|
||||
static int hash(const Position& position)
|
||||
static int hash(Position const& position)
|
||||
{
|
||||
return int_hash(position.line) ^ int_hash(position.column);
|
||||
}
|
||||
|
||||
static bool equals(const Position& a, const Position& b)
|
||||
static bool equals(Position const& a, Position const& b)
|
||||
{
|
||||
return a.column == b.column && a.line == b.line;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
size_t byte_length() const { return buffer_impl().size(); }
|
||||
size_t max_byte_length() const { return m_max_byte_length.value(); } // Will VERIFY() that it has value
|
||||
ByteBuffer& buffer() { return buffer_impl(); }
|
||||
const ByteBuffer& buffer() const { return buffer_impl(); }
|
||||
ByteBuffer const& buffer() const { return buffer_impl(); }
|
||||
|
||||
// Used by allocate_array_buffer() to attach the data block after construction
|
||||
void set_buffer(ByteBuffer buffer) { m_buffer = move(buffer); }
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
return *ptr;
|
||||
}
|
||||
|
||||
const ByteBuffer& buffer_impl() const { return const_cast<ArrayBuffer*>(this)->buffer_impl(); }
|
||||
ByteBuffer const& buffer_impl() const { return const_cast<ArrayBuffer*>(this)->buffer_impl(); }
|
||||
|
||||
Variant<Empty, ByteBuffer, ByteBuffer*> m_buffer;
|
||||
// The various detach related members of ArrayBuffer are not used by any ECMA262 functionality,
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
explicit BigInt(Crypto::SignedBigInteger);
|
||||
virtual ~BigInt() override = default;
|
||||
|
||||
const Crypto::SignedBigInteger& big_integer() const { return m_big_integer; }
|
||||
Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; }
|
||||
const String to_string() const { return String::formatted("{}n", m_big_integer.to_base(10)); }
|
||||
|
||||
private:
|
||||
|
|
|
@ -35,7 +35,7 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::to_string)
|
|||
if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object()))
|
||||
return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean");
|
||||
|
||||
bool bool_value = static_cast<const BooleanObject&>(this_value.as_object()).boolean();
|
||||
bool bool_value = static_cast<BooleanObject const&>(this_value.as_object()).boolean();
|
||||
return js_string(vm, bool_value ? "true" : "false");
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,6 @@ JS_DEFINE_NATIVE_FUNCTION(BooleanPrototype::value_of)
|
|||
if (!this_value.is_object() || !is<BooleanObject>(this_value.as_object()))
|
||||
return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOfType, "Boolean");
|
||||
|
||||
return Value(static_cast<const BooleanObject&>(this_value.as_object()).boolean());
|
||||
return Value(static_cast<BooleanObject const&>(this_value.as_object()).boolean());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
|
||||
virtual ThrowCompletionOr<Object*> internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) override;
|
||||
|
||||
virtual const FlyString& name() const override { return m_name; }
|
||||
virtual FlyString const& name() const override { return m_name; }
|
||||
virtual bool is_strict_mode() const override { return m_bound_target_function->is_strict_mode(); }
|
||||
virtual bool has_constructor() const override { return m_bound_target_function->has_constructor(); }
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
namespace JS {
|
||||
|
||||
// 21.4.3.2 Date.parse ( string ), https://tc39.es/ecma262/#sec-date.parse
|
||||
static Value parse_simplified_iso8601(GlobalObject& global_object, const String& iso_8601)
|
||||
static Value parse_simplified_iso8601(GlobalObject& global_object, String const& iso_8601)
|
||||
{
|
||||
// 21.4.1.15 Date Time String Format, https://tc39.es/ecma262/#sec-date-time-string-format
|
||||
GenericLexer lexer(iso_8601);
|
||||
|
|
|
@ -875,7 +875,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body()
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void ECMAScriptFunctionObject::set_name(const FlyString& name)
|
||||
void ECMAScriptFunctionObject::set_name(FlyString const& name)
|
||||
{
|
||||
VERIFY(!name.is_null());
|
||||
auto& vm = this->vm();
|
||||
|
|
|
@ -47,8 +47,8 @@ public:
|
|||
Statement const& ecmascript_code() const { return m_ecmascript_code; }
|
||||
Vector<FunctionNode::Parameter> const& formal_parameters() const { return m_formal_parameters; };
|
||||
|
||||
virtual const FlyString& name() const override { return m_name; };
|
||||
void set_name(const FlyString& name);
|
||||
virtual FlyString const& name() const override { return m_name; };
|
||||
void set_name(FlyString const& name);
|
||||
|
||||
void set_is_class_constructor() { m_is_class_constructor = true; };
|
||||
|
||||
|
|
|
@ -302,18 +302,18 @@ public:
|
|||
JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR)
|
||||
#undef __ENUMERATE_JS_ERROR
|
||||
|
||||
const char* message() const
|
||||
char const* message() const
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
private:
|
||||
explicit ErrorType(const char* message)
|
||||
explicit ErrorType(char const* message)
|
||||
: m_message(message)
|
||||
{
|
||||
}
|
||||
|
||||
const char* m_message;
|
||||
char const* m_message;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) = 0;
|
||||
virtual ThrowCompletionOr<Object*> internal_construct([[maybe_unused]] MarkedVector<Value> arguments_list, [[maybe_unused]] FunctionObject& new_target) { VERIFY_NOT_REACHED(); }
|
||||
|
||||
virtual const FlyString& name() const = 0;
|
||||
virtual FlyString const& name() const = 0;
|
||||
|
||||
void set_function_name(Variant<PropertyKey, PrivateName> const& name_arg, Optional<StringView> const& prefix = {});
|
||||
void set_function_length(double length);
|
||||
|
|
|
@ -488,7 +488,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::eval)
|
|||
}
|
||||
|
||||
// 19.2.6.1.1 Encode ( string, unescapedSet ), https://tc39.es/ecma262/#sec-encode
|
||||
static ThrowCompletionOr<String> encode([[maybe_unused]] JS::GlobalObject& global_object, const String& string, StringView unescaped_set)
|
||||
static ThrowCompletionOr<String> encode([[maybe_unused]] JS::GlobalObject& global_object, String const& string, StringView unescaped_set)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
auto utf16_string = Utf16String(string);
|
||||
|
@ -544,7 +544,7 @@ static ThrowCompletionOr<String> encode([[maybe_unused]] JS::GlobalObject& globa
|
|||
}
|
||||
|
||||
// 19.2.6.1.2 Decode ( string, reservedSet ), https://tc39.es/ecma262/#sec-decode
|
||||
static ThrowCompletionOr<String> decode(JS::GlobalObject& global_object, const String& string, StringView reserved_set)
|
||||
static ThrowCompletionOr<String> decode(JS::GlobalObject& global_object, String const& string, StringView reserved_set)
|
||||
{
|
||||
StringBuilder decoded_builder;
|
||||
auto code_point_start_offset = 0u;
|
||||
|
|
|
@ -177,7 +177,7 @@ bool GenericIndexedPropertyStorage::set_array_like_size(size_t new_size)
|
|||
return !any_failed;
|
||||
}
|
||||
|
||||
IndexedPropertyIterator::IndexedPropertyIterator(const IndexedProperties& indexed_properties, u32 staring_index, bool skip_empty)
|
||||
IndexedPropertyIterator::IndexedPropertyIterator(IndexedProperties const& indexed_properties, u32 staring_index, bool skip_empty)
|
||||
: m_indexed_properties(indexed_properties)
|
||||
, m_index(staring_index)
|
||||
, m_skip_empty(skip_empty)
|
||||
|
@ -203,7 +203,7 @@ IndexedPropertyIterator& IndexedPropertyIterator::operator*()
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool IndexedPropertyIterator::operator!=(const IndexedPropertyIterator& other) const
|
||||
bool IndexedPropertyIterator::operator!=(IndexedPropertyIterator const& other) const
|
||||
{
|
||||
return m_index != other.m_index;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ size_t IndexedProperties::real_size() const
|
|||
if (!m_storage)
|
||||
return 0;
|
||||
if (m_storage->is_simple_storage()) {
|
||||
auto& packed_elements = static_cast<const SimpleIndexedPropertyStorage&>(*m_storage).elements();
|
||||
auto& packed_elements = static_cast<SimpleIndexedPropertyStorage const&>(*m_storage).elements();
|
||||
size_t size = 0;
|
||||
for (auto& element : packed_elements) {
|
||||
if (!element.is_empty())
|
||||
|
@ -273,7 +273,7 @@ size_t IndexedProperties::real_size() const
|
|||
}
|
||||
return size;
|
||||
}
|
||||
return static_cast<const GenericIndexedPropertyStorage&>(*m_storage).size();
|
||||
return static_cast<GenericIndexedPropertyStorage const&>(*m_storage).size();
|
||||
}
|
||||
|
||||
Vector<u32> IndexedProperties::indices() const
|
||||
|
@ -281,8 +281,8 @@ Vector<u32> IndexedProperties::indices() const
|
|||
if (!m_storage)
|
||||
return {};
|
||||
if (m_storage->is_simple_storage()) {
|
||||
const auto& storage = static_cast<const SimpleIndexedPropertyStorage&>(*m_storage);
|
||||
const auto& elements = storage.elements();
|
||||
auto const& storage = static_cast<SimpleIndexedPropertyStorage const&>(*m_storage);
|
||||
auto const& elements = storage.elements();
|
||||
Vector<u32> indices;
|
||||
indices.ensure_capacity(storage.array_like_size());
|
||||
for (size_t i = 0; i < elements.size(); ++i) {
|
||||
|
@ -291,7 +291,7 @@ Vector<u32> IndexedProperties::indices() const
|
|||
}
|
||||
return indices;
|
||||
}
|
||||
const auto& storage = static_cast<const GenericIndexedPropertyStorage&>(*m_storage);
|
||||
auto const& storage = static_cast<GenericIndexedPropertyStorage const&>(*m_storage);
|
||||
auto indices = storage.sparse_elements().keys();
|
||||
quick_sort(indices);
|
||||
return indices;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
virtual bool set_array_like_size(size_t new_size) override;
|
||||
|
||||
virtual bool is_simple_storage() const override { return true; }
|
||||
const Vector<Value>& elements() const { return m_packed_elements; }
|
||||
Vector<Value> const& elements() const { return m_packed_elements; }
|
||||
|
||||
private:
|
||||
friend GenericIndexedPropertyStorage;
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
virtual size_t array_like_size() const override { return m_array_size; }
|
||||
virtual bool set_array_like_size(size_t new_size) override;
|
||||
|
||||
const HashMap<u32, ValueAndAttributes>& sparse_elements() const { return m_sparse_elements; }
|
||||
HashMap<u32, ValueAndAttributes> const& sparse_elements() const { return m_sparse_elements; }
|
||||
|
||||
private:
|
||||
size_t m_array_size { 0 };
|
||||
|
@ -95,18 +95,18 @@ private:
|
|||
|
||||
class IndexedPropertyIterator {
|
||||
public:
|
||||
IndexedPropertyIterator(const IndexedProperties&, u32 starting_index, bool skip_empty);
|
||||
IndexedPropertyIterator(IndexedProperties const&, u32 starting_index, bool skip_empty);
|
||||
|
||||
IndexedPropertyIterator& operator++();
|
||||
IndexedPropertyIterator& operator*();
|
||||
bool operator!=(const IndexedPropertyIterator&) const;
|
||||
bool operator!=(IndexedPropertyIterator const&) const;
|
||||
|
||||
u32 index() const { return m_index; };
|
||||
|
||||
private:
|
||||
void skip_empty_indices();
|
||||
|
||||
const IndexedProperties& m_indexed_properties;
|
||||
IndexedProperties const& m_indexed_properties;
|
||||
Vector<u32> m_cached_indices;
|
||||
u32 m_index { 0 };
|
||||
bool m_skip_empty { false };
|
||||
|
@ -149,7 +149,7 @@ public:
|
|||
for (auto& value : static_cast<SimpleIndexedPropertyStorage&>(*m_storage).elements())
|
||||
callback(value);
|
||||
} else {
|
||||
for (auto& element : static_cast<const GenericIndexedPropertyStorage&>(*m_storage).sparse_elements())
|
||||
for (auto& element : static_cast<GenericIndexedPropertyStorage const&>(*m_storage).sparse_elements())
|
||||
callback(element.value.value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::stringify)
|
|||
}
|
||||
|
||||
// 25.5.2.1 SerializeJSONProperty ( state, key, holder ), https://tc39.es/ecma262/#sec-serializejsonproperty
|
||||
ThrowCompletionOr<String> JSONObject::serialize_json_property(GlobalObject& global_object, StringifyState& state, const PropertyKey& key, Object* holder)
|
||||
ThrowCompletionOr<String> JSONObject::serialize_json_property(GlobalObject& global_object, StringifyState& state, PropertyKey const& key, Object* holder)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
|
||||
|
@ -229,7 +229,7 @@ ThrowCompletionOr<String> JSONObject::serialize_json_object(GlobalObject& global
|
|||
state.indent = String::formatted("{}{}", state.indent, state.gap);
|
||||
Vector<String> property_strings;
|
||||
|
||||
auto process_property = [&](const PropertyKey& key) -> ThrowCompletionOr<void> {
|
||||
auto process_property = [&](PropertyKey const& key) -> ThrowCompletionOr<void> {
|
||||
if (key.is_symbol())
|
||||
return {};
|
||||
auto serialized_property_string = TRY(serialize_json_property(global_object, state, key, &object));
|
||||
|
@ -408,7 +408,7 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::parse)
|
|||
return unfiltered;
|
||||
}
|
||||
|
||||
Value JSONObject::parse_json_value(GlobalObject& global_object, const JsonValue& value)
|
||||
Value JSONObject::parse_json_value(GlobalObject& global_object, JsonValue const& value)
|
||||
{
|
||||
if (value.is_object())
|
||||
return Value(parse_json_object(global_object, value.as_object()));
|
||||
|
@ -427,7 +427,7 @@ Value JSONObject::parse_json_value(GlobalObject& global_object, const JsonValue&
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Object* JSONObject::parse_json_object(GlobalObject& global_object, const JsonObject& json_object)
|
||||
Object* JSONObject::parse_json_object(GlobalObject& global_object, JsonObject const& json_object)
|
||||
{
|
||||
auto* object = Object::create(global_object, global_object.object_prototype());
|
||||
json_object.for_each_member([&](auto& key, auto& value) {
|
||||
|
@ -436,7 +436,7 @@ Object* JSONObject::parse_json_object(GlobalObject& global_object, const JsonObj
|
|||
return object;
|
||||
}
|
||||
|
||||
Array* JSONObject::parse_json_array(GlobalObject& global_object, const JsonArray& json_array)
|
||||
Array* JSONObject::parse_json_array(GlobalObject& global_object, JsonArray const& json_array)
|
||||
{
|
||||
auto* array = MUST(Array::create(global_object, 0));
|
||||
size_t index = 0;
|
||||
|
@ -455,7 +455,7 @@ ThrowCompletionOr<Value> JSONObject::internalize_json_property(GlobalObject& glo
|
|||
auto is_array = TRY(value.is_array(global_object));
|
||||
|
||||
auto& value_object = value.as_object();
|
||||
auto process_property = [&](const PropertyKey& key) -> ThrowCompletionOr<void> {
|
||||
auto process_property = [&](PropertyKey const& key) -> ThrowCompletionOr<void> {
|
||||
auto element = TRY(internalize_json_property(global_object, &value_object, key, reviver));
|
||||
if (element.is_undefined())
|
||||
TRY(value_object.internal_delete(key));
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
// test-js to communicate between the JS tests and the C++ test runner.
|
||||
static ThrowCompletionOr<String> stringify_impl(GlobalObject&, Value value, Value replacer, Value space);
|
||||
|
||||
static Value parse_json_value(GlobalObject&, const JsonValue&);
|
||||
static Value parse_json_value(GlobalObject&, JsonValue const&);
|
||||
|
||||
private:
|
||||
struct StringifyState {
|
||||
|
@ -34,14 +34,14 @@ private:
|
|||
};
|
||||
|
||||
// Stringify helpers
|
||||
static ThrowCompletionOr<String> serialize_json_property(GlobalObject&, StringifyState&, const PropertyKey& key, Object* holder);
|
||||
static ThrowCompletionOr<String> serialize_json_property(GlobalObject&, StringifyState&, PropertyKey const& key, Object* holder);
|
||||
static ThrowCompletionOr<String> serialize_json_object(GlobalObject&, StringifyState&, Object&);
|
||||
static ThrowCompletionOr<String> serialize_json_array(GlobalObject&, StringifyState&, Object&);
|
||||
static String quote_json_string(String);
|
||||
|
||||
// Parse helpers
|
||||
static Object* parse_json_object(GlobalObject&, const JsonObject&);
|
||||
static Array* parse_json_array(GlobalObject&, const JsonArray&);
|
||||
static Object* parse_json_object(GlobalObject&, JsonObject const&);
|
||||
static Array* parse_json_array(GlobalObject&, JsonArray const&);
|
||||
static ThrowCompletionOr<Value> internalize_json_property(GlobalObject&, Object* holder, PropertyKey const& name, FunctionObject& reviver);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(stringify);
|
||||
|
|
|
@ -51,7 +51,7 @@ NativeFunction* NativeFunction::create(GlobalObject& global_object, Function<Thr
|
|||
return function;
|
||||
}
|
||||
|
||||
NativeFunction* NativeFunction::create(GlobalObject& global_object, const FlyString& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> function)
|
||||
NativeFunction* NativeFunction::create(GlobalObject& global_object, FlyString const& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> function)
|
||||
{
|
||||
return global_object.heap().allocate<NativeFunction>(global_object, name, move(function), *global_object.function_prototype());
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class NativeFunction : public FunctionObject {
|
|||
|
||||
public:
|
||||
static NativeFunction* create(GlobalObject&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> behaviour, i32 length, PropertyKey const& name, Optional<Realm*> = {}, Optional<Object*> prototype = {}, Optional<StringView> const& prefix = {});
|
||||
static NativeFunction* create(GlobalObject&, const FlyString& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>);
|
||||
static NativeFunction* create(GlobalObject&, FlyString const& name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>);
|
||||
|
||||
NativeFunction(GlobalObject&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>, Object* prototype, Realm& realm);
|
||||
NativeFunction(FlyString name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>, Object& prototype);
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
virtual ThrowCompletionOr<Value> call();
|
||||
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target);
|
||||
|
||||
virtual const FlyString& name() const override { return m_name; };
|
||||
virtual FlyString const& name() const override { return m_name; };
|
||||
virtual bool is_strict_mode() const override;
|
||||
virtual bool has_constructor() const override { return false; }
|
||||
virtual Realm* realm() const override { return m_realm; }
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
# define MAX_SAFE_INTEGER_VALUE AK::exp2(53.) - 1
|
||||
# define MIN_SAFE_INTEGER_VALUE -(AK::exp2(53.) - 1)
|
||||
#else
|
||||
constexpr const double EPSILON_VALUE { __builtin_exp2(-52) };
|
||||
constexpr const double MAX_SAFE_INTEGER_VALUE { __builtin_exp2(53) - 1 };
|
||||
constexpr const double MIN_SAFE_INTEGER_VALUE { -(__builtin_exp2(53) - 1) };
|
||||
constexpr double const EPSILON_VALUE { __builtin_exp2(-52) };
|
||||
constexpr double const MAX_SAFE_INTEGER_VALUE { __builtin_exp2(53) - 1 };
|
||||
constexpr double const MIN_SAFE_INTEGER_VALUE { -(__builtin_exp2(53) - 1) };
|
||||
#endif
|
||||
|
||||
namespace JS {
|
||||
|
|
|
@ -1083,7 +1083,7 @@ void Object::ensure_shape_is_unique()
|
|||
}
|
||||
|
||||
// Simple side-effect free property lookup, following the prototype chain. Non-standard.
|
||||
Value Object::get_without_side_effects(const PropertyKey& property_key) const
|
||||
Value Object::get_without_side_effects(PropertyKey const& property_key) const
|
||||
{
|
||||
auto* object = this;
|
||||
while (object) {
|
||||
|
|
|
@ -149,7 +149,7 @@ public:
|
|||
|
||||
// Non-standard methods
|
||||
|
||||
Value get_without_side_effects(const PropertyKey&) const;
|
||||
Value get_without_side_effects(PropertyKey const&) const;
|
||||
|
||||
void define_direct_property(PropertyKey const& property_key, Value value, PropertyAttributes attributes) { storage_set(property_key, { value, attributes }); };
|
||||
void define_direct_accessor(PropertyKey const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes);
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
|
||||
Value get_direct(size_t index) const { return m_storage[index]; }
|
||||
|
||||
const IndexedProperties& indexed_properties() const { return m_indexed_properties; }
|
||||
IndexedProperties const& indexed_properties() const { return m_indexed_properties; }
|
||||
IndexedProperties& indexed_properties() { return m_indexed_properties; }
|
||||
void set_indexed_property_elements(Vector<Value>&& values) { m_indexed_properties = IndexedProperties(move(values)); }
|
||||
|
||||
|
|
|
@ -74,10 +74,10 @@ public:
|
|||
virtual ~PromiseReaction() = default;
|
||||
|
||||
Type type() const { return m_type; }
|
||||
const Optional<PromiseCapability>& capability() const { return m_capability; }
|
||||
Optional<PromiseCapability> const& capability() const { return m_capability; }
|
||||
|
||||
Optional<JobCallback>& handler() { return m_handler; }
|
||||
const Optional<JobCallback>& handler() const { return m_handler; }
|
||||
Optional<JobCallback> const& handler() const { return m_handler; }
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "PromiseReaction"sv; }
|
||||
|
|
|
@ -58,8 +58,8 @@ public:
|
|||
m_bits &= ~Attribute::Configurable;
|
||||
}
|
||||
|
||||
bool operator==(const PropertyAttributes& other) const { return m_bits == other.m_bits; }
|
||||
bool operator!=(const PropertyAttributes& other) const { return m_bits != other.m_bits; }
|
||||
bool operator==(PropertyAttributes const& other) const { return m_bits == other.m_bits; }
|
||||
bool operator!=(PropertyAttributes const& other) const { return m_bits != other.m_bits; }
|
||||
|
||||
[[nodiscard]] u8 bits() const { return m_bits; }
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_prevent_extensions()
|
|||
}
|
||||
|
||||
// 10.5.5 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p
|
||||
ThrowCompletionOr<Optional<PropertyDescriptor>> ProxyObject::internal_get_own_property(const PropertyKey& property_key) const
|
||||
ThrowCompletionOr<Optional<PropertyDescriptor>> ProxyObject::internal_get_own_property(PropertyKey const& property_key) const
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& global_object = this->global_object();
|
||||
|
@ -858,7 +858,7 @@ void ProxyObject::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(&m_handler);
|
||||
}
|
||||
|
||||
const FlyString& ProxyObject::name() const
|
||||
FlyString const& ProxyObject::name() const
|
||||
{
|
||||
VERIFY(is_function());
|
||||
return static_cast<FunctionObject&>(m_target).name();
|
||||
|
|
|
@ -21,11 +21,11 @@ public:
|
|||
ProxyObject(Object& target, Object& handler, Object& prototype);
|
||||
virtual ~ProxyObject() override = default;
|
||||
|
||||
virtual const FlyString& name() const override;
|
||||
virtual FlyString const& name() const override;
|
||||
virtual bool has_constructor() const override;
|
||||
|
||||
const Object& target() const { return m_target; }
|
||||
const Object& handler() const { return m_handler; }
|
||||
Object const& target() const { return m_target; }
|
||||
Object const& handler() const { return m_handler; }
|
||||
|
||||
bool is_revoked() const { return m_is_revoked; }
|
||||
void revoke() { m_is_revoked = true; }
|
||||
|
|
|
@ -44,10 +44,10 @@ public:
|
|||
virtual void initialize(GlobalObject&) override;
|
||||
virtual ~RegExpObject() override = default;
|
||||
|
||||
const String& pattern() const { return m_pattern; }
|
||||
const String& flags() const { return m_flags; }
|
||||
const Regex<ECMA262>& regex() { return *m_regex; }
|
||||
const Regex<ECMA262>& regex() const { return *m_regex; }
|
||||
String const& pattern() const { return m_pattern; }
|
||||
String const& flags() const { return m_flags; }
|
||||
Regex<ECMA262> const& regex() { return *m_regex; }
|
||||
Regex<ECMA262> const& regex() const { return *m_regex; }
|
||||
|
||||
private:
|
||||
String m_pattern;
|
||||
|
|
|
@ -53,7 +53,7 @@ Shape* Shape::get_or_prune_cached_prototype_transition(Object* prototype)
|
|||
return it->value;
|
||||
}
|
||||
|
||||
Shape* Shape::create_put_transition(const StringOrSymbol& property_key, PropertyAttributes attributes)
|
||||
Shape* Shape::create_put_transition(StringOrSymbol const& property_key, PropertyAttributes attributes)
|
||||
{
|
||||
TransitionKey key { property_key, attributes };
|
||||
if (auto* existing_shape = get_or_prune_cached_forward_transition(key))
|
||||
|
@ -65,7 +65,7 @@ Shape* Shape::create_put_transition(const StringOrSymbol& property_key, Property
|
|||
return new_shape;
|
||||
}
|
||||
|
||||
Shape* Shape::create_configure_transition(const StringOrSymbol& property_key, PropertyAttributes attributes)
|
||||
Shape* Shape::create_configure_transition(StringOrSymbol const& property_key, PropertyAttributes attributes)
|
||||
{
|
||||
TransitionKey key { property_key, attributes };
|
||||
if (auto* existing_shape = get_or_prune_cached_forward_transition(key))
|
||||
|
@ -93,7 +93,7 @@ Shape::Shape(Object& global_object)
|
|||
{
|
||||
}
|
||||
|
||||
Shape::Shape(Shape& previous_shape, const StringOrSymbol& property_key, PropertyAttributes attributes, TransitionType transition_type)
|
||||
Shape::Shape(Shape& previous_shape, StringOrSymbol const& property_key, PropertyAttributes attributes, TransitionType transition_type)
|
||||
: m_global_object(previous_shape.m_global_object)
|
||||
, m_previous(&previous_shape)
|
||||
, m_property_key(property_key)
|
||||
|
@ -126,7 +126,7 @@ void Shape::visit_edges(Cell::Visitor& visitor)
|
|||
}
|
||||
}
|
||||
|
||||
Optional<PropertyMetadata> Shape::lookup(const StringOrSymbol& property_key) const
|
||||
Optional<PropertyMetadata> Shape::lookup(StringOrSymbol const& property_key) const
|
||||
{
|
||||
if (m_property_count == 0)
|
||||
return {};
|
||||
|
@ -162,7 +162,7 @@ void Shape::ensure_property_table() const
|
|||
|
||||
u32 next_offset = 0;
|
||||
|
||||
Vector<const Shape*, 64> transition_chain;
|
||||
Vector<Shape const*, 64> transition_chain;
|
||||
for (auto* shape = m_previous; shape; shape = shape->m_previous) {
|
||||
if (shape->m_property_table) {
|
||||
*m_property_table = *shape->m_property_table;
|
||||
|
@ -189,7 +189,7 @@ void Shape::ensure_property_table() const
|
|||
}
|
||||
}
|
||||
|
||||
void Shape::add_property_to_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes)
|
||||
void Shape::add_property_to_unique_shape(StringOrSymbol const& property_key, PropertyAttributes attributes)
|
||||
{
|
||||
VERIFY(is_unique());
|
||||
VERIFY(m_property_table);
|
||||
|
@ -200,7 +200,7 @@ void Shape::add_property_to_unique_shape(const StringOrSymbol& property_key, Pro
|
|||
++m_property_count;
|
||||
}
|
||||
|
||||
void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes)
|
||||
void Shape::reconfigure_property_in_unique_shape(StringOrSymbol const& property_key, PropertyAttributes attributes)
|
||||
{
|
||||
VERIFY(is_unique());
|
||||
VERIFY(m_property_table);
|
||||
|
@ -210,7 +210,7 @@ void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_
|
|||
m_property_table->set(property_key, it->value);
|
||||
}
|
||||
|
||||
void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_key, size_t offset)
|
||||
void Shape::remove_property_from_unique_shape(StringOrSymbol const& property_key, size_t offset)
|
||||
{
|
||||
VERIFY(is_unique());
|
||||
VERIFY(m_property_table);
|
||||
|
|
|
@ -28,7 +28,7 @@ struct TransitionKey {
|
|||
StringOrSymbol property_key;
|
||||
PropertyAttributes attributes { 0 };
|
||||
|
||||
bool operator==(const TransitionKey& other) const
|
||||
bool operator==(TransitionKey const& other) const
|
||||
{
|
||||
return property_key == other.property_key && attributes == other.attributes;
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ public:
|
|||
|
||||
explicit Shape(ShapeWithoutGlobalObjectTag) {};
|
||||
explicit Shape(Object& global_object);
|
||||
Shape(Shape& previous_shape, const StringOrSymbol& property_key, PropertyAttributes attributes, TransitionType);
|
||||
Shape(Shape& previous_shape, StringOrSymbol const& property_key, PropertyAttributes attributes, TransitionType);
|
||||
Shape(Shape& previous_shape, Object* new_prototype);
|
||||
|
||||
Shape* create_put_transition(const StringOrSymbol&, PropertyAttributes attributes);
|
||||
Shape* create_configure_transition(const StringOrSymbol&, PropertyAttributes attributes);
|
||||
Shape* create_put_transition(StringOrSymbol const&, PropertyAttributes attributes);
|
||||
Shape* create_configure_transition(StringOrSymbol const&, PropertyAttributes attributes);
|
||||
Shape* create_prototype_transition(Object* new_prototype);
|
||||
|
||||
void add_property_without_transition(const StringOrSymbol&, PropertyAttributes);
|
||||
void add_property_without_transition(StringOrSymbol const&, PropertyAttributes);
|
||||
void add_property_without_transition(PropertyKey const&, PropertyAttributes);
|
||||
|
||||
bool is_unique() const { return m_unique; }
|
||||
|
@ -67,10 +67,10 @@ public:
|
|||
GlobalObject* global_object() const;
|
||||
|
||||
Object* prototype() { return m_prototype; }
|
||||
const Object* prototype() const { return m_prototype; }
|
||||
Object const* prototype() const { return m_prototype; }
|
||||
|
||||
Optional<PropertyMetadata> lookup(const StringOrSymbol&) const;
|
||||
const HashMap<StringOrSymbol, PropertyMetadata>& property_table() const;
|
||||
Optional<PropertyMetadata> lookup(StringOrSymbol const&) const;
|
||||
HashMap<StringOrSymbol, PropertyMetadata> const& property_table() const;
|
||||
u32 property_count() const { return m_property_count; }
|
||||
|
||||
struct Property {
|
||||
|
@ -82,9 +82,9 @@ public:
|
|||
|
||||
void set_prototype_without_transition(Object* new_prototype) { m_prototype = new_prototype; }
|
||||
|
||||
void remove_property_from_unique_shape(const StringOrSymbol&, size_t offset);
|
||||
void add_property_to_unique_shape(const StringOrSymbol&, PropertyAttributes attributes);
|
||||
void reconfigure_property_in_unique_shape(const StringOrSymbol& property_key, PropertyAttributes attributes);
|
||||
void remove_property_from_unique_shape(StringOrSymbol const&, size_t offset);
|
||||
void add_property_to_unique_shape(StringOrSymbol const&, PropertyAttributes attributes);
|
||||
void reconfigure_property_in_unique_shape(StringOrSymbol const& property_key, PropertyAttributes attributes);
|
||||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "Shape"sv; }
|
||||
|
|
|
@ -73,7 +73,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
|
|||
if (literal_segments == 0)
|
||||
return js_string(vm, "");
|
||||
|
||||
const auto number_of_substituions = vm.argument_count() - 1;
|
||||
auto const number_of_substituions = vm.argument_count() - 1;
|
||||
|
||||
StringBuilder builder;
|
||||
for (size_t i = 0; i < literal_segments; ++i) {
|
||||
|
|
|
@ -931,7 +931,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::search)
|
|||
}
|
||||
|
||||
// B.2.2.2.1 CreateHTML ( string, tag, attribute, value ), https://tc39.es/ecma262/#sec-createhtml
|
||||
static ThrowCompletionOr<Value> create_html(GlobalObject& global_object, Value string, const String& tag, const String& attribute, Value value)
|
||||
static ThrowCompletionOr<Value> create_html(GlobalObject& global_object, Value string, String const& tag, String const& attribute, Value value)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
TRY(require_object_coercible(global_object, string));
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~Symbol() = default;
|
||||
|
||||
String description() const { return m_description.value_or(""); }
|
||||
const Optional<String>& raw_description() const { return m_description; }
|
||||
Optional<String> const& raw_description() const { return m_description; }
|
||||
bool is_global() const { return m_is_global; }
|
||||
String to_string() const { return String::formatted("Symbol({})", description()); }
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~SymbolObject() override = default;
|
||||
|
||||
Symbol& primitive_symbol() { return m_symbol; }
|
||||
const Symbol& primitive_symbol() const { return m_symbol; }
|
||||
Symbol const& primitive_symbol() const { return m_symbol; }
|
||||
|
||||
String description() const { return m_symbol.description(); }
|
||||
bool is_global() const { return m_symbol.is_global(); }
|
||||
|
|
|
@ -32,9 +32,9 @@ private:
|
|||
};
|
||||
|
||||
// -86400 * 10^17
|
||||
const auto INSTANT_NANOSECONDS_MIN = "-8640000000000000000000"_sbigint;
|
||||
auto const INSTANT_NANOSECONDS_MIN = "-8640000000000000000000"_sbigint;
|
||||
// +86400 * 10^17
|
||||
const auto INSTANT_NANOSECONDS_MAX = "8640000000000000000000"_sbigint;
|
||||
auto const INSTANT_NANOSECONDS_MAX = "8640000000000000000000"_sbigint;
|
||||
|
||||
bool is_valid_epoch_nanoseconds(BigInt const& epoch_nanoseconds);
|
||||
ThrowCompletionOr<Instant*> create_temporal_instant(GlobalObject&, BigInt const& nanoseconds, FunctionObject const* new_target = nullptr);
|
||||
|
|
|
@ -74,9 +74,9 @@ BigInt* get_epoch_from_iso_parts(GlobalObject& global_object, i32 year, u8 month
|
|||
}
|
||||
|
||||
// -864 * 10^19 - 864 * 10^11
|
||||
const auto DATETIME_NANOSECONDS_MIN = "-8640000086400000000000"_sbigint;
|
||||
auto const DATETIME_NANOSECONDS_MIN = "-8640000086400000000000"_sbigint;
|
||||
// +864 * 10^19 + 864 * 10^11
|
||||
const auto DATETIME_NANOSECONDS_MAX = "8640000086400000000000"_sbigint;
|
||||
auto const DATETIME_NANOSECONDS_MAX = "8640000086400000000000"_sbigint;
|
||||
|
||||
// 5.5.2 ISODateTimeWithinLimits ( year, month, day, hour, minute, second, millisecond, microsecond, nanosecond ), https://tc39.es/proposal-temporal/#sec-temporal-isodatetimewithinlimits
|
||||
bool iso_date_time_within_limits(GlobalObject& global_object, i32 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond)
|
||||
|
|
|
@ -230,7 +230,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_typed_array(GlobalObj
|
|||
|
||||
// 23.2.5.1.5 InitializeTypedArrayFromArrayLike, https://tc39.es/ecma262/#sec-initializetypedarrayfromarraylike
|
||||
template<typename T>
|
||||
static ThrowCompletionOr<void> initialize_typed_array_from_array_like(GlobalObject& global_object, TypedArray<T>& typed_array, const Object& array_like)
|
||||
static ThrowCompletionOr<void> initialize_typed_array_from_array_like(GlobalObject& global_object, TypedArray<T>& typed_array, Object const& array_like)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
|
||||
|
@ -291,7 +291,7 @@ static ThrowCompletionOr<void> initialize_typed_array_from_array_like(GlobalObje
|
|||
|
||||
// 23.2.5.1.4 InitializeTypedArrayFromList, https://tc39.es/ecma262/#sec-initializetypedarrayfromlist
|
||||
template<typename T>
|
||||
static ThrowCompletionOr<void> initialize_typed_array_from_list(GlobalObject& global_object, TypedArray<T>& typed_array, const MarkedVector<Value>& list)
|
||||
static ThrowCompletionOr<void> initialize_typed_array_from_list(GlobalObject& global_object, TypedArray<T>& typed_array, MarkedVector<Value> const& list)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ public:
|
|||
|
||||
Span<const UnderlyingBufferDataType> data() const
|
||||
{
|
||||
return { reinterpret_cast<const UnderlyingBufferDataType*>(m_viewed_array_buffer->buffer().data() + m_byte_offset), m_array_length };
|
||||
return { reinterpret_cast<UnderlyingBufferDataType const*>(m_viewed_array_buffer->buffer().data() + m_byte_offset), m_array_length };
|
||||
}
|
||||
Span<UnderlyingBufferDataType> data()
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
TypedArrayConstructor::TypedArrayConstructor(const FlyString& name, Object& prototype)
|
||||
TypedArrayConstructor::TypedArrayConstructor(FlyString const& name, Object& prototype)
|
||||
: NativeFunction(name, prototype)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class TypedArrayConstructor : public NativeFunction {
|
|||
JS_OBJECT(TypedArrayConstructor, NativeFunction);
|
||||
|
||||
public:
|
||||
TypedArrayConstructor(const FlyString& name, Object& prototype);
|
||||
TypedArrayConstructor(FlyString const& name, Object& prototype);
|
||||
explicit TypedArrayConstructor(GlobalObject&);
|
||||
virtual void initialize(GlobalObject&) override;
|
||||
virtual ~TypedArrayConstructor() override = default;
|
||||
|
|
|
@ -82,7 +82,7 @@ static ThrowCompletionOr<TypedArrayBase*> validate_typed_array_from_this(GlobalO
|
|||
return typed_array;
|
||||
}
|
||||
|
||||
static ThrowCompletionOr<FunctionObject*> callback_from_args(GlobalObject& global_object, const String& name)
|
||||
static ThrowCompletionOr<FunctionObject*> callback_from_args(GlobalObject& global_object, String const& name)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
if (vm.argument_count() < 1)
|
||||
|
@ -93,7 +93,7 @@ static ThrowCompletionOr<FunctionObject*> callback_from_args(GlobalObject& globa
|
|||
return &callback.as_function();
|
||||
}
|
||||
|
||||
static ThrowCompletionOr<void> for_each_item(VM& vm, GlobalObject& global_object, const String& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback)
|
||||
static ThrowCompletionOr<void> for_each_item(VM& vm, GlobalObject& global_object, String const& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback)
|
||||
{
|
||||
auto* typed_array = TRY(validate_typed_array_from_this(global_object));
|
||||
|
||||
|
@ -115,7 +115,7 @@ static ThrowCompletionOr<void> for_each_item(VM& vm, GlobalObject& global_object
|
|||
return {};
|
||||
}
|
||||
|
||||
static ThrowCompletionOr<void> for_each_item_from_last(VM& vm, GlobalObject& global_object, const String& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback)
|
||||
static ThrowCompletionOr<void> for_each_item_from_last(VM& vm, GlobalObject& global_object, String const& name, Function<IterationDecision(size_t index, Value value, Value callback_result)> callback)
|
||||
{
|
||||
auto* typed_array = TRY(validate_typed_array_from_this(global_object));
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ void VM::gather_roots(HashTable<Cell*>& roots)
|
|||
roots.set(finalization_registry);
|
||||
}
|
||||
|
||||
Symbol* VM::get_global_symbol(const String& description)
|
||||
Symbol* VM::get_global_symbol(String const& description)
|
||||
{
|
||||
auto result = m_global_symbol_map.get(description);
|
||||
if (result.has_value())
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
};
|
||||
|
||||
Heap& heap() { return m_heap; }
|
||||
const Heap& heap() const { return m_heap; }
|
||||
Heap const& heap() const { return m_heap; }
|
||||
|
||||
Interpreter& interpreter();
|
||||
Interpreter* interpreter_if_exists();
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
|
||||
#undef __JS_ENUMERATE
|
||||
|
||||
Symbol* get_global_symbol(const String& description);
|
||||
Symbol* get_global_symbol(String const& description);
|
||||
|
||||
HashMap<String, PrimitiveString*>& string_cache() { return m_string_cache; }
|
||||
PrimitiveString& empty_string() { return *m_empty_string; }
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
|
||||
ThrowCompletionOr<Value> resolve_this_binding(GlobalObject&);
|
||||
|
||||
const StackInfo& stack_info() const { return m_stack_info; };
|
||||
StackInfo const& stack_info() const { return m_stack_info; };
|
||||
|
||||
u32 execution_generation() const { return m_execution_generation; }
|
||||
void finish_execution_generation() { ++m_execution_generation; }
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
static inline bool same_type_for_equality(const Value& lhs, const Value& rhs)
|
||||
static inline bool same_type_for_equality(Value const& lhs, Value const& rhs)
|
||||
{
|
||||
if (lhs.type() == rhs.type())
|
||||
return true;
|
||||
|
@ -50,12 +50,12 @@ static inline bool same_type_for_equality(const Value& lhs, const Value& rhs)
|
|||
|
||||
static const Crypto::SignedBigInteger BIGINT_ZERO { 0 };
|
||||
|
||||
ALWAYS_INLINE bool both_number(const Value& lhs, const Value& rhs)
|
||||
ALWAYS_INLINE bool both_number(Value const& lhs, Value const& rhs)
|
||||
{
|
||||
return lhs.is_number() && rhs.is_number();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool both_bigint(const Value& lhs, const Value& rhs)
|
||||
ALWAYS_INLINE bool both_bigint(Value const& lhs, Value const& rhs)
|
||||
{
|
||||
return lhs.is_bigint() && rhs.is_bigint();
|
||||
}
|
||||
|
@ -1295,7 +1295,7 @@ ThrowCompletionOr<Value> ordinary_has_instance(GlobalObject& global_object, Valu
|
|||
auto& rhs_function = rhs.as_function();
|
||||
|
||||
if (is<BoundFunction>(rhs_function)) {
|
||||
auto& bound_target = static_cast<const BoundFunction&>(rhs_function);
|
||||
auto& bound_target = static_cast<BoundFunction const&>(rhs_function);
|
||||
return instance_of(global_object, lhs, Value(&bound_target.bound_target_function()));
|
||||
}
|
||||
|
||||
|
|
|
@ -178,31 +178,31 @@ public:
|
|||
m_value.as_i32 = value;
|
||||
}
|
||||
|
||||
Value(const Object* object)
|
||||
Value(Object const* object)
|
||||
: m_type(object ? Type::Object : Type::Null)
|
||||
{
|
||||
m_value.as_object = const_cast<Object*>(object);
|
||||
}
|
||||
|
||||
Value(const PrimitiveString* string)
|
||||
Value(PrimitiveString const* string)
|
||||
: m_type(Type::String)
|
||||
{
|
||||
m_value.as_string = const_cast<PrimitiveString*>(string);
|
||||
}
|
||||
|
||||
Value(const Symbol* symbol)
|
||||
Value(Symbol const* symbol)
|
||||
: m_type(Type::Symbol)
|
||||
{
|
||||
m_value.as_symbol = const_cast<Symbol*>(symbol);
|
||||
}
|
||||
|
||||
Value(const Accessor* accessor)
|
||||
Value(Accessor const* accessor)
|
||||
: m_type(Type::Accessor)
|
||||
{
|
||||
m_value.as_accessor = const_cast<Accessor*>(accessor);
|
||||
}
|
||||
|
||||
Value(const BigInt* bigint)
|
||||
Value(BigInt const* bigint)
|
||||
: m_type(Type::BigInt)
|
||||
{
|
||||
m_value.as_bigint = const_cast<BigInt*>(bigint);
|
||||
|
@ -235,7 +235,7 @@ public:
|
|||
return *m_value.as_object;
|
||||
}
|
||||
|
||||
const Object& as_object() const
|
||||
Object const& as_object() const
|
||||
{
|
||||
VERIFY(type() == Type::Object);
|
||||
return *m_value.as_object;
|
||||
|
@ -247,7 +247,7 @@ public:
|
|||
return *m_value.as_string;
|
||||
}
|
||||
|
||||
const PrimitiveString& as_string() const
|
||||
PrimitiveString const& as_string() const
|
||||
{
|
||||
VERIFY(is_string());
|
||||
return *m_value.as_string;
|
||||
|
@ -259,7 +259,7 @@ public:
|
|||
return *m_value.as_symbol;
|
||||
}
|
||||
|
||||
const Symbol& as_symbol() const
|
||||
Symbol const& as_symbol() const
|
||||
{
|
||||
VERIFY(is_symbol());
|
||||
return *m_value.as_symbol;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
static Syntax::TextStyle style_for_token_type(const Gfx::Palette& palette, JS::TokenType type)
|
||||
static Syntax::TextStyle style_for_token_type(Gfx::Palette const& palette, JS::TokenType type)
|
||||
{
|
||||
switch (JS::Token::category(type)) {
|
||||
case JS::TokenCategory::Invalid:
|
||||
|
@ -47,7 +47,7 @@ bool SyntaxHighlighter::is_navigatable([[maybe_unused]] u64 token) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void SyntaxHighlighter::rehighlight(const Palette& palette)
|
||||
void SyntaxHighlighter::rehighlight(Palette const& palette)
|
||||
{
|
||||
auto text = m_client->get_text();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual bool is_navigatable(u64) const override;
|
||||
|
||||
virtual Syntax::Language language() const override { return Syntax::Language::JavaScript; }
|
||||
virtual void rehighlight(const Palette&) override;
|
||||
virtual void rehighlight(Palette const&) override;
|
||||
|
||||
protected:
|
||||
virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace JS {
|
||||
|
||||
const char* Token::name(TokenType type)
|
||||
char const* Token::name(TokenType type)
|
||||
{
|
||||
switch (type) {
|
||||
#define __ENUMERATE_JS_TOKEN(type, category) \
|
||||
|
@ -27,7 +27,7 @@ const char* Token::name(TokenType type)
|
|||
}
|
||||
}
|
||||
|
||||
const char* Token::name() const
|
||||
char const* Token::name() const
|
||||
{
|
||||
return name(m_type);
|
||||
}
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
namespace JS {
|
||||
|
||||
// U+2028 LINE SEPARATOR
|
||||
constexpr const char line_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa8, 0 };
|
||||
constexpr char const line_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa8, 0 };
|
||||
constexpr const StringView LINE_SEPARATOR_STRING { line_separator_chars };
|
||||
constexpr const u32 LINE_SEPARATOR { 0x2028 };
|
||||
|
||||
// U+2029 PARAGRAPH SEPARATOR
|
||||
constexpr const char paragraph_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa9, 0 };
|
||||
constexpr char const paragraph_separator_chars[] { (char)0xe2, (char)0x80, (char)0xa9, 0 };
|
||||
constexpr const StringView PARAGRAPH_SEPARATOR_STRING { paragraph_separator_chars };
|
||||
constexpr const u32 PARAGRAPH_SEPARATOR { 0x2029 };
|
||||
|
||||
|
@ -197,10 +197,10 @@ public:
|
|||
TokenType type() const { return m_type; }
|
||||
TokenCategory category() const;
|
||||
static TokenCategory category(TokenType);
|
||||
const char* name() const;
|
||||
static const char* name(TokenType);
|
||||
char const* name() const;
|
||||
static char const* name(TokenType);
|
||||
|
||||
const String& message() const { return m_message; }
|
||||
String const& message() const { return m_message; }
|
||||
StringView trivia() const { return m_trivia; }
|
||||
StringView original_value() const { return m_original_value; }
|
||||
StringView value() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue