diff options
-rw-r--r-- | Libraries/LibJS/AST.cpp | 12 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ArrayPrototype.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ErrorPrototype.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ErrorTypes.h | 66 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/IteratorOperations.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/Object.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ObjectConstructor.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ProxyConstructor.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ProxyObject.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/Reference.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ReflectObject.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/ScriptFunction.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/SymbolConstructor.cpp | 2 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/VM.h | 2 | ||||
-rw-r--r-- | Libraries/LibJS/Runtime/Value.cpp | 10 |
15 files changed, 64 insertions, 64 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index b355d2a562..6a0e1ed026 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -132,7 +132,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete if (interpreter.exception()) return {}; if (is_super_property_lookup && lookup_target.is_nullish()) { - interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::ObjectPrototypeNullOrUndefinedOnSuperPropertyAccess, lookup_target.to_string_without_side_effects().characters()); + interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::ObjectPrototypeNullOrUndefinedOnSuperPropertyAccess, lookup_target.to_string_without_side_effects()); return {}; } @@ -167,9 +167,9 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj } else { expression_string = static_cast<const MemberExpression&>(*m_callee).to_string_approximation(); } - interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::IsNotAEvaluatedFrom, callee.to_string_without_side_effects().characters(), call_type, expression_string.characters()); + interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::IsNotAEvaluatedFrom, callee.to_string_without_side_effects(), call_type, expression_string); } else { - interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::IsNotA, callee.to_string_without_side_effects().characters(), call_type); + interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::IsNotA, callee.to_string_without_side_effects(), call_type); } return {}; } @@ -692,7 +692,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob if (interpreter.exception()) return {}; if (!super_constructor.is_function() && !super_constructor.is_null()) { - interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::ClassDoesNotExtendAConstructorOrNull, super_constructor.to_string_without_side_effects().characters()); + interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::ClassDoesNotExtendAConstructorOrNull, super_constructor.to_string_without_side_effects()); return {}; } class_constructor->set_constructor_kind(Function::ConstructorKind::Derived); @@ -1163,7 +1163,7 @@ Value Identifier::execute(Interpreter& interpreter, GlobalObject& global_object) { auto value = interpreter.vm().get_variable(string(), global_object); if (value.is_empty()) { - interpreter.vm().throw_exception<ReferenceError>(global_object, ErrorType::UnknownIdentifier, string().characters()); + interpreter.vm().throw_exception<ReferenceError>(global_object, ErrorType::UnknownIdentifier, string()); return {}; } return value; @@ -1731,7 +1731,7 @@ Value TaggedTemplateLiteral::execute(Interpreter& interpreter, GlobalObject& glo if (interpreter.exception()) return {}; if (!tag.is_function()) { - interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::NotAFunction, tag.to_string_without_side_effects().characters()); + interpreter.vm().throw_exception<TypeError>(global_object, ErrorType::NotAFunction, tag.to_string_without_side_effects()); return {}; } auto& tag_function = tag.as_function(); diff --git a/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Libraries/LibJS/Runtime/ArrayPrototype.cpp index bef371a353..d41a71a66b 100644 --- a/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -90,12 +90,12 @@ static Function* callback_from_args(GlobalObject& global_object, const String& n { auto& vm = global_object.vm(); if (vm.argument_count() < 1) { - vm.throw_exception<TypeError>(global_object, ErrorType::ArrayPrototypeOneArg, name.characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::ArrayPrototypeOneArg, name); return nullptr; } auto callback = vm.argument(0); if (!callback.is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotAFunction, callback.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAFunction, callback.to_string_without_side_effects()); return nullptr; } return &callback.as_function(); diff --git a/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Libraries/LibJS/Runtime/ErrorPrototype.cpp index d676b24585..09b25b0d40 100644 --- a/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -94,7 +94,7 @@ JS_DEFINE_NATIVE_GETTER(ErrorPrototype::message_getter) JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string) { if (!vm.this_value(global_object).is_object()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObject, vm.this_value(global_object).to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObject, vm.this_value(global_object).to_string_without_side_effects()); return {}; } auto& this_object = vm.this_value(global_object).as_object(); diff --git a/Libraries/LibJS/Runtime/ErrorTypes.h b/Libraries/LibJS/Runtime/ErrorTypes.h index 493ffc216c..23792d643b 100644 --- a/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Libraries/LibJS/Runtime/ErrorTypes.h @@ -29,52 +29,52 @@ #define JS_ENUMERATE_ERROR_TYPES(M) \ M(ArrayInvalidLength, "Invalid array length") \ M(ArrayMaxSize, "Maximum array size exceeded") \ - M(ArrayPrototypeOneArg, "Array.prototype.%s() requires at least one argument") \ - M(AccessorBadField, "Accessor descriptor's '%s' field must be a function or undefined") \ + M(ArrayPrototypeOneArg, "Array.prototype.{}() requires at least one argument") \ + M(AccessorBadField, "Accessor descriptor's '{}' field must be a function or undefined") \ M(AccessorValueOrWritable, "Accessor property descriptor cannot specify a value or writable key") \ - M(BigIntBadOperator, "Cannot use %s operator with BigInt") \ - M(BigIntBadOperatorOtherType, "Cannot use %s operator with BigInt and other type") \ + M(BigIntBadOperator, "Cannot use {} operator with BigInt") \ + M(BigIntBadOperatorOtherType, "Cannot use {} operator with BigInt and other type") \ M(BigIntIntArgument, "BigInt argument must be an integer") \ - M(BigIntInvalidValue, "Invalid value for BigInt: %s") \ - M(ClassDoesNotExtendAConstructorOrNull, "Class extends value %s is not a constructor or null") \ - M(Convert, "Cannot convert %s to %s") \ + M(BigIntInvalidValue, "Invalid value for BigInt: {}") \ + M(ClassDoesNotExtendAConstructorOrNull, "Class extends value {} is not a constructor or null") \ + M(Convert, "Cannot convert {} to {}") \ M(ConvertUndefinedToObject, "Cannot convert undefined to object") \ - M(DescChangeNonConfigurable, "Cannot change attributes of non-configurable property '%s'") \ + M(DescChangeNonConfigurable, "Cannot change attributes of non-configurable property '{}'") \ M(FunctionArgsNotObject, "Argument array must be an object") \ M(InOperatorWithObject, "'in' operator must be used on an object") \ - M(InstanceOfOperatorBadPrototype, "'prototype' property of %s is not an object") \ + M(InstanceOfOperatorBadPrototype, "'prototype' property of {} is not an object") \ M(InvalidAssignToConst, "Invalid assignment to const variable") \ M(InvalidLeftHandAssignment, "Invalid left-hand side in assignment") \ M(InvalidRadix, "Radix must be an integer no less than 2, and no greater than 36") \ - M(IsNotA, "%s is not a %s") \ - M(IsNotAEvaluatedFrom, "%s is not a %s (evaluated from '%s')") \ + M(IsNotA, "{} is not a {}") \ + M(IsNotAEvaluatedFrom, "{} is not a {} (evaluated from '{}')") \ M(IterableNextBadReturn, "iterator.next() returned a non-object value") \ M(IterableNextNotAFunction, "'next' property on returned object from Symbol.iterator method is " \ "not a function") \ M(JsonBigInt, "Cannot serialize BigInt value to JSON") \ M(JsonCircular, "Cannot stringify circular object") \ M(JsonMalformed, "Malformed JSON string") \ - M(NotA, "Not a %s object") \ - M(NotAConstructor, "%s is not a constructor") \ - M(NotAFunction, "%s is not a function") \ + M(NotA, "Not a {} object") \ + M(NotAConstructor, "{} is not a constructor") \ + M(NotAFunction, "{} is not a function") \ M(NotAFunctionNoParam, "Not a function") \ - M(NotAn, "Not an %s object") \ - M(NotAnObject, "%s is not an object") \ - M(NotASymbol, "%s is not a symbol") \ - M(NotIterable, "%s is not iterable") \ - M(NonExtensibleDefine, "Cannot define property %s on non-extensible object") \ - M(NumberIncompatibleThis, "Number.prototype.%s method called with incompatible this target") \ + M(NotAn, "Not an {} object") \ + M(NotAnObject, "{} is not an object") \ + M(NotASymbol, "{} is not a symbol") \ + M(NotIterable, "{} is not iterable") \ + M(NonExtensibleDefine, "Cannot define property {} on non-extensible object") \ + M(NumberIncompatibleThis, "Number.prototype.{} method called with incompatible this target") \ M(ObjectDefinePropertyReturnedFalse, "Object's [[DefineProperty]] method returned false") \ M(ObjectSetPrototypeOfReturnedFalse, "Object's [[SetPrototypeOf]] method returned false") \ M(ObjectSetPrototypeOfTwoArgs, "Object.setPrototypeOf requires at least two arguments") \ M(ObjectPreventExtensionsReturnedFalse, "Object's [[PreventExtensions]] method returned false") \ M(ObjectPrototypeNullOrUndefinedOnSuperPropertyAccess, \ - "Object prototype must not be %s on a super property access") \ + "Object prototype must not be {} on a super property access") \ M(ObjectPrototypeWrongType, "Prototype must be an object or null") \ M(ProxyCallWithNew, "Proxy must be called with the 'new' operator") \ M(ProxyConstructBadReturnType, "Proxy handler's construct trap violates invariant: must return " \ "an object") \ - M(ProxyConstructorBadType, "Expected %s argument of Proxy constructor to be object, got %s") \ + M(ProxyConstructorBadType, "Expected {} argument of Proxy constructor to be object, got {}") \ M(ProxyDefinePropExistingConfigurable, "Proxy handler's defineProperty trap violates " \ "invariant: a property cannot be defined as non-configurable if it already exists on the " \ "target object as a configurable property") \ @@ -121,7 +121,7 @@ M(ProxyHasExistingNonExtensible, "Proxy handler's has trap violates invariant: a property " \ "cannot be reported as non-existent if it exists on the target and the target is " \ "non-extensible") \ - M(ProxyInvalidTrap, "Proxy handler's %s trap wasn't undefined, null, or callable") \ + M(ProxyInvalidTrap, "Proxy handler's {} trap wasn't undefined, null, or callable") \ M(ProxyIsExtensibleReturn, "Proxy handler's isExtensible trap violates invariant: " \ "return value must match the target's extensibility") \ M(ProxyPreventExtensionsReturn, "Proxy handler's preventExtensions trap violates " \ @@ -138,24 +138,24 @@ "target is non-extensible") \ M(ProxyTwoArguments, "Proxy constructor requires at least two arguments") \ M(ReduceNoInitial, "Reduce of empty array with no initial value") \ - M(ReferencePrimitiveAssignment, "Cannot assign property %s to primitive value") \ + M(ReferencePrimitiveAssignment, "Cannot assign property {} to primitive value") \ M(ReferenceUnresolvable, "Unresolvable reference") \ - M(ReflectArgumentMustBeAFunction, "First argument of Reflect.%s() must be a function") \ - M(ReflectArgumentMustBeAnObject, "First argument of Reflect.%s() must be an object") \ + M(ReflectArgumentMustBeAFunction, "First argument of Reflect.{}() must be a function") \ + M(ReflectArgumentMustBeAnObject, "First argument of Reflect.{}() must be an object") \ M(ReflectBadArgumentsList, "Arguments list must be an object") \ M(ReflectBadNewTarget, "Optional third argument of Reflect.construct() must be a constructor") \ M(ReflectBadDescriptorArgument, "Descriptor argument is not an object") \ - M(StringRawCannotConvert, "Cannot convert property 'raw' to object from %s") \ - M(StringRepeatCountMustBe, "repeat count must be a %s number") \ + M(StringRawCannotConvert, "Cannot convert property 'raw' to object from {}") \ + M(StringRepeatCountMustBe, "repeat count must be a {} number") \ M(ThisHasNotBeenInitialized, "|this| has not been initialized") \ M(ThisIsAlreadyInitialized, "|this| is already initialized") \ M(ToObjectNullOrUndef, "ToObject on null or undefined") \ - M(UnknownIdentifier, "'%s' is not defined") \ + M(UnknownIdentifier, "'{}' is not defined") \ /* LibWeb bindings */ \ - M(NotAByteString, "Argument to %s() must be a byte string") \ - M(BadArgCountOne, "%s() needs one argument") \ - M(BadArgCountAtLeastOne, "%s() needs at least one argument") \ - M(BadArgCountMany, "%s() needs %s arguments") + M(NotAByteString, "Argument to {}() must be a byte string") \ + M(BadArgCountOne, "{}() needs one argument") \ + M(BadArgCountAtLeastOne, "{}() needs at least one argument") \ + M(BadArgCountMany, "{}() needs {} arguments") namespace JS { diff --git a/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Libraries/LibJS/Runtime/IteratorOperations.cpp index 97bf57337e..c8a794e076 100644 --- a/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -45,14 +45,14 @@ Object* get_iterator(GlobalObject& global_object, Value value, String hint, Valu return {}; } if (!method.is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotIterable, value.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotIterable, value.to_string_without_side_effects()); return nullptr; } auto iterator = vm.call(method.as_function(), value); if (vm.exception()) return {}; if (!iterator.is_object()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotIterable, value.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotIterable, value.to_string_without_side_effects()); return nullptr; } return &iterator.as_object(); diff --git a/Libraries/LibJS/Runtime/Object.cpp b/Libraries/LibJS/Runtime/Object.cpp index deaaec6554..7fd765baa6 100644 --- a/Libraries/LibJS/Runtime/Object.cpp +++ b/Libraries/LibJS/Runtime/Object.cpp @@ -464,7 +464,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert dbg() << "Disallow define_property of non-extensible object"; #endif if (throw_exceptions && vm().in_strict_mode()) - vm().throw_exception<TypeError>(global_object(), ErrorType::NonExtensibleDefine, property_name.to_display_string().characters()); + vm().throw_exception<TypeError>(global_object(), ErrorType::NonExtensibleDefine, property_name.to_display_string()); return false; } @@ -498,7 +498,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert dbg() << "Disallow reconfig of non-configurable property"; #endif if (throw_exceptions) - vm().throw_exception<TypeError>(global_object(), ErrorType::DescChangeNonConfigurable, property_name.to_display_string().characters()); + vm().throw_exception<TypeError>(global_object(), ErrorType::DescChangeNonConfigurable, property_name.to_display_string()); return false; } @@ -860,7 +860,7 @@ Value Object::invoke(const StringOrSymbol& property_name, Optional<MarkedValueLi if (vm.exception()) return {}; if (!property.is_function()) { - vm.throw_exception<TypeError>(global_object(), ErrorType::NotAFunction, property.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object(), ErrorType::NotAFunction, property.to_string_without_side_effects()); return {}; } return vm.call(property.as_function(), this, move(arguments)); diff --git a/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 736b3ea900..f6c6cb7d77 100644 --- a/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -181,7 +181,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property_) if (object.is_proxy_object()) { vm.throw_exception<TypeError>(global_object, ErrorType::ObjectDefinePropertyReturnedFalse); } else { - vm.throw_exception<TypeError>(global_object, ErrorType::NonExtensibleDefine, property_key.to_display_string().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NonExtensibleDefine, property_key.to_display_string()); } } return {}; diff --git a/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Libraries/LibJS/Runtime/ProxyConstructor.cpp index 2c0b8bb734..293b70ec61 100644 --- a/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -66,11 +66,11 @@ Value ProxyConstructor::construct(Function&) auto handler = vm.argument(1); if (!target.is_object()) { - vm.throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects()); return {}; } if (!handler.is_object()) { - vm.throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object(), ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects()); return {}; } return ProxyObject::create(global_object(), target.as_object(), handler.as_object()); diff --git a/Libraries/LibJS/Runtime/ProxyObject.cpp b/Libraries/LibJS/Runtime/ProxyObject.cpp index 48413be261..45b04f8354 100644 --- a/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -462,7 +462,7 @@ void ProxyObject::visit_children(Cell::Visitor& visitor) Value ProxyObject::call() { if (!is_function()) { - vm().throw_exception<TypeError>(global_object(), ErrorType::NotAFunction, Value(this).to_string_without_side_effects().characters()); + vm().throw_exception<TypeError>(global_object(), ErrorType::NotAFunction, Value(this).to_string_without_side_effects()); return {}; } if (m_is_revoked) { @@ -495,7 +495,7 @@ Value ProxyObject::construct(Function& new_target) { auto& vm = this->vm(); if (!is_function()) { - vm.throw_exception<TypeError>(global_object(), ErrorType::NotAConstructor, Value(this).to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object(), ErrorType::NotAConstructor, Value(this).to_string_without_side_effects()); return {}; } if (m_is_revoked) { diff --git a/Libraries/LibJS/Runtime/Reference.cpp b/Libraries/LibJS/Runtime/Reference.cpp index 5e25732604..ee13097681 100644 --- a/Libraries/LibJS/Runtime/Reference.cpp +++ b/Libraries/LibJS/Runtime/Reference.cpp @@ -50,7 +50,7 @@ void Reference::put(GlobalObject& global_object, Value value) } if (!base().is_object() && vm.in_strict_mode()) { - vm.throw_exception<TypeError>(global_object, ErrorType::ReferencePrimitiveAssignment, m_name.to_string().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::ReferencePrimitiveAssignment, m_name.to_string()); return; } @@ -68,7 +68,7 @@ void Reference::throw_reference_error(GlobalObject& global_object) if (property_name.is_empty()) { global_object.vm().throw_exception<ReferenceError>(global_object, ErrorType::ReferenceUnresolvable); } else { - global_object.vm().throw_exception<ReferenceError>(global_object, ErrorType::UnknownIdentifier, property_name.characters()); + global_object.vm().throw_exception<ReferenceError>(global_object, ErrorType::UnknownIdentifier, property_name); } } diff --git a/Libraries/LibJS/Runtime/ReflectObject.cpp b/Libraries/LibJS/Runtime/ReflectObject.cpp index 9f465e56b0..8ab3bbe144 100644 --- a/Libraries/LibJS/Runtime/ReflectObject.cpp +++ b/Libraries/LibJS/Runtime/ReflectObject.cpp @@ -38,7 +38,7 @@ static Object* get_target_object_from(GlobalObject& global_object, const String& auto& vm = global_object.vm(); auto target = vm.argument(0); if (!target.is_object()) { - vm.throw_exception<TypeError>(global_object, ErrorType::ReflectArgumentMustBeAnObject, name.characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::ReflectArgumentMustBeAnObject, name); return nullptr; } return static_cast<Object*>(&target.as_object()); @@ -49,7 +49,7 @@ static Function* get_target_function_from(GlobalObject& global_object, const Str auto& vm = global_object.vm(); auto target = vm.argument(0); if (!target.is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::ReflectArgumentMustBeAFunction, name.characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::ReflectArgumentMustBeAFunction, name); return nullptr; } return &target.as_function(); diff --git a/Libraries/LibJS/Runtime/ScriptFunction.cpp b/Libraries/LibJS/Runtime/ScriptFunction.cpp index 2e012d5903..7104f646e3 100644 --- a/Libraries/LibJS/Runtime/ScriptFunction.cpp +++ b/Libraries/LibJS/Runtime/ScriptFunction.cpp @@ -148,7 +148,7 @@ Value ScriptFunction::call() Value ScriptFunction::construct(Function&) { if (m_is_arrow_function) { - vm().throw_exception<TypeError>(global_object(), ErrorType::NotAConstructor, m_name.characters()); + vm().throw_exception<TypeError>(global_object(), ErrorType::NotAConstructor, m_name); return {}; } return call(); diff --git a/Libraries/LibJS/Runtime/SymbolConstructor.cpp b/Libraries/LibJS/Runtime/SymbolConstructor.cpp index 17b07928e0..b5b8b4815f 100644 --- a/Libraries/LibJS/Runtime/SymbolConstructor.cpp +++ b/Libraries/LibJS/Runtime/SymbolConstructor.cpp @@ -84,7 +84,7 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::key_for) { auto argument = vm.argument(0); if (!argument.is_symbol()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotASymbol, argument.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotASymbol, argument.to_string_without_side_effects()); return {}; } diff --git a/Libraries/LibJS/Runtime/VM.h b/Libraries/LibJS/Runtime/VM.h index 09d8cb3404..c7f95da39c 100644 --- a/Libraries/LibJS/Runtime/VM.h +++ b/Libraries/LibJS/Runtime/VM.h @@ -197,7 +197,7 @@ public: template<typename T, typename... Args> void throw_exception(GlobalObject& global_object, ErrorType type, Args&&... args) { - return throw_exception(global_object, T::create(global_object, String::format(type.message(), forward<Args>(args)...))); + return throw_exception(global_object, T::create(global_object, String::formatted(type.message(), forward<Args>(args)...))); } Value construct(Function&, Function& new_target, Optional<MarkedValueList> arguments, GlobalObject&); diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index f31147e9f9..448bb68ab3 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -312,7 +312,7 @@ BigInt* Value::to_bigint(GlobalObject& global_object) const case Type::String: { auto& string = primitive.as_string().string(); if (!is_valid_bigint_value(string)) { - vm.throw_exception<SyntaxError>(global_object, ErrorType::BigIntInvalidValue, string.characters()); + vm.throw_exception<SyntaxError>(global_object, ErrorType::BigIntInvalidValue, string); return {}; } return js_bigint(vm.heap(), Crypto::SignedBigInteger::from_base10(string.trim_whitespace())); @@ -702,13 +702,13 @@ Value instance_of(GlobalObject& global_object, Value lhs, Value rhs) { auto& vm = global_object.vm(); if (!rhs.is_object()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObject, rhs.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAnObject, rhs.to_string_without_side_effects()); return {}; } auto has_instance_method = rhs.as_object().get(vm.well_known_symbol_has_instance()); if (!has_instance_method.is_empty()) { if (!has_instance_method.is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotAFunction, has_instance_method.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAFunction, has_instance_method.to_string_without_side_effects()); return {}; } @@ -716,7 +716,7 @@ Value instance_of(GlobalObject& global_object, Value lhs, Value rhs) } if (!rhs.is_function()) { - vm.throw_exception<TypeError>(global_object, ErrorType::NotAFunction, rhs.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::NotAFunction, rhs.to_string_without_side_effects()); return {}; } return ordinary_has_instance(global_object, lhs, rhs); @@ -743,7 +743,7 @@ Value ordinary_has_instance(GlobalObject& global_object, Value lhs, Value rhs) return {}; if (!rhs_prototype.is_object()) { - vm.throw_exception<TypeError>(global_object, ErrorType::InstanceOfOperatorBadPrototype, rhs_prototype.to_string_without_side_effects().characters()); + vm.throw_exception<TypeError>(global_object, ErrorType::InstanceOfOperatorBadPrototype, rhs_prototype.to_string_without_side_effects()); return {}; } while (true) { |