diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2020-09-18 09:49:51 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-25 21:18:17 +0200 |
commit | 08f9bc26a6b279d0f09be13d7305ad8b2f094884 (patch) | |
tree | 5091688b83f9ceabc7aeff0daa5c167460832b1f /Libraries/LibJS | |
parent | ede5dbd7b3ec1c7240d6ca2693a5ada307338b4c (diff) | |
download | serenity-08f9bc26a6b279d0f09be13d7305ad8b2f094884.zip |
Meta+LibHTTP through LibWeb: Make clang-format-10 clean
Diffstat (limited to 'Libraries/LibJS')
21 files changed, 179 insertions, 177 deletions
diff --git a/Libraries/LibJS/Forward.h b/Libraries/LibJS/Forward.h index ad26ba6b08..178dafc6a2 100644 --- a/Libraries/LibJS/Forward.h +++ b/Libraries/LibJS/Forward.h @@ -58,38 +58,38 @@ __JS_ENUMERATE(StringObject, string, StringPrototype, StringConstructor) \ __JS_ENUMERATE(SymbolObject, symbol, SymbolPrototype, SymbolConstructor) -#define JS_ENUMERATE_ERROR_SUBCLASSES \ - __JS_ENUMERATE(EvalError, eval_error, EvalErrorPrototype, EvalErrorConstructor) \ - __JS_ENUMERATE(InternalError, internal_error, InternalErrorPrototype, InternalErrorConstructor) \ - __JS_ENUMERATE(InvalidCharacterError, invalid_character_error, InvalidCharacterErrorPrototype, InvalidCharacterErrorConstructor) \ - __JS_ENUMERATE(RangeError, range_error, RangeErrorPrototype, RangeErrorConstructor) \ - __JS_ENUMERATE(ReferenceError, reference_error, ReferenceErrorPrototype, ReferenceErrorConstructor) \ - __JS_ENUMERATE(SyntaxError, syntax_error, SyntaxErrorPrototype, SyntaxErrorConstructor) \ - __JS_ENUMERATE(TypeError, type_error, TypeErrorPrototype, TypeErrorConstructor) \ +#define JS_ENUMERATE_ERROR_SUBCLASSES \ + __JS_ENUMERATE(EvalError, eval_error, EvalErrorPrototype, EvalErrorConstructor) \ + __JS_ENUMERATE(InternalError, internal_error, InternalErrorPrototype, InternalErrorConstructor) \ + __JS_ENUMERATE(InvalidCharacterError, invalid_character_error, InvalidCharacterErrorPrototype, InvalidCharacterErrorConstructor) \ + __JS_ENUMERATE(RangeError, range_error, RangeErrorPrototype, RangeErrorConstructor) \ + __JS_ENUMERATE(ReferenceError, reference_error, ReferenceErrorPrototype, ReferenceErrorConstructor) \ + __JS_ENUMERATE(SyntaxError, syntax_error, SyntaxErrorPrototype, SyntaxErrorConstructor) \ + __JS_ENUMERATE(TypeError, type_error, TypeErrorPrototype, TypeErrorConstructor) \ __JS_ENUMERATE(URIError, uri_error, URIErrorPrototype, URIErrorConstructor) -#define JS_ENUMERATE_ITERATOR_PROTOTYPES \ - __JS_ENUMERATE(Iterator, iterator) \ - __JS_ENUMERATE(ArrayIterator, array_iterator) \ +#define JS_ENUMERATE_ITERATOR_PROTOTYPES \ + __JS_ENUMERATE(Iterator, iterator) \ + __JS_ENUMERATE(ArrayIterator, array_iterator) \ __JS_ENUMERATE(StringIterator, string_iterator) #define JS_ENUMERATE_BUILTIN_TYPES \ JS_ENUMERATE_NATIVE_OBJECTS \ JS_ENUMERATE_ERROR_SUBCLASSES -#define JS_ENUMERATE_WELL_KNOWN_SYMBOLS \ - __JS_ENUMERATE(iterator, iterator) \ - __JS_ENUMERATE(asyncIterator, async_iterator) \ - __JS_ENUMERATE(match, match) \ - __JS_ENUMERATE(matchAll, match_all) \ - __JS_ENUMERATE(replace, replace) \ - __JS_ENUMERATE(search, search) \ - __JS_ENUMERATE(split, split) \ - __JS_ENUMERATE(hasInstance, has_instance) \ - __JS_ENUMERATE(isConcatSpreadable, is_concat_spreadable) \ - __JS_ENUMERATE(unscopables, unscopables) \ - __JS_ENUMERATE(species, species) \ - __JS_ENUMERATE(toPrimitive, to_primitive) \ +#define JS_ENUMERATE_WELL_KNOWN_SYMBOLS \ + __JS_ENUMERATE(iterator, iterator) \ + __JS_ENUMERATE(asyncIterator, async_iterator) \ + __JS_ENUMERATE(match, match) \ + __JS_ENUMERATE(matchAll, match_all) \ + __JS_ENUMERATE(replace, replace) \ + __JS_ENUMERATE(search, search) \ + __JS_ENUMERATE(split, split) \ + __JS_ENUMERATE(hasInstance, has_instance) \ + __JS_ENUMERATE(isConcatSpreadable, is_concat_spreadable) \ + __JS_ENUMERATE(unscopables, unscopables) \ + __JS_ENUMERATE(species, species) \ + __JS_ENUMERATE(toPrimitive, to_primitive) \ __JS_ENUMERATE(toStringTag, to_string_tag) namespace JS { diff --git a/Libraries/LibJS/Heap/Handle.h b/Libraries/LibJS/Heap/Handle.h index a4400fcd16..e2686395fc 100644 --- a/Libraries/LibJS/Heap/Handle.h +++ b/Libraries/LibJS/Heap/Handle.h @@ -55,7 +55,7 @@ private: template<class T> class Handle { public: - Handle() {} + Handle() { } static Handle create(T* cell) { diff --git a/Libraries/LibJS/Runtime/ArrayIterator.cpp b/Libraries/LibJS/Runtime/ArrayIterator.cpp index 926495ef44..6257ac1235 100644 --- a/Libraries/LibJS/Runtime/ArrayIterator.cpp +++ b/Libraries/LibJS/Runtime/ArrayIterator.cpp @@ -45,7 +45,7 @@ ArrayIterator::~ArrayIterator() { } -void ArrayIterator::visit_children(Cell::Visitor & visitor) +void ArrayIterator::visit_children(Cell::Visitor& visitor) { Base::visit_children(visitor); visitor.visit(m_array); diff --git a/Libraries/LibJS/Runtime/DateConstructor.cpp b/Libraries/LibJS/Runtime/DateConstructor.cpp index 1f614ef626..c17e84c47e 100644 --- a/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -37,7 +37,8 @@ namespace JS { -static Value parse_simplified_iso8601(const String& iso_8601) { +static Value parse_simplified_iso8601(const String& iso_8601) +{ // Date.parse() is allowed to accept many formats. We strictly only accept things matching // http://www.ecma-international.org/ecma-262/#sec-date-time-string-format GenericLexer lexer(iso_8601); diff --git a/Libraries/LibJS/Runtime/DatePrototype.h b/Libraries/LibJS/Runtime/DatePrototype.h index d43404c467..5c8c8bebd4 100644 --- a/Libraries/LibJS/Runtime/DatePrototype.h +++ b/Libraries/LibJS/Runtime/DatePrototype.h @@ -32,6 +32,7 @@ namespace JS { class DatePrototype final : public Object { JS_OBJECT(DatePrototype, Object); + public: explicit DatePrototype(GlobalObject&); virtual void initialize(GlobalObject&) override; diff --git a/Libraries/LibJS/Runtime/Error.cpp b/Libraries/LibJS/Runtime/Error.cpp index 200f0055e1..1a6123aee5 100644 --- a/Libraries/LibJS/Runtime/Error.cpp +++ b/Libraries/LibJS/Runtime/Error.cpp @@ -56,7 +56,7 @@ Error::~Error() : Error(#ClassName, message, prototype) \ { \ } \ - ClassName::~ClassName() { } \ + ClassName::~ClassName() { } JS_ENUMERATE_ERROR_SUBCLASSES #undef __JS_ENUMERATE diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.cpp b/Libraries/LibJS/Runtime/ErrorConstructor.cpp index 01fe8ccc34..f87b201dfe 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.cpp +++ b/Libraries/LibJS/Runtime/ErrorConstructor.cpp @@ -68,16 +68,16 @@ Value ErrorConstructor::construct(Interpreter& interpreter, Function&) : NativeFunction(*global_object.function_prototype()) \ { \ } \ - void ConstructorName::initialize(GlobalObject& global_object) \ + void ConstructorName::initialize(GlobalObject& global_object) \ { \ - NativeFunction::initialize(global_object); \ + NativeFunction::initialize(global_object); \ define_property("prototype", global_object.snake_name##_prototype(), 0); \ define_property("length", Value(1), Attribute::Configurable); \ } \ ConstructorName::~ConstructorName() { } \ Value ConstructorName::call(Interpreter& interpreter) \ { \ - return construct(interpreter, *this); \ + return construct(interpreter, *this); \ } \ Value ConstructorName::construct(Interpreter& interpreter, Function&) \ { \ diff --git a/Libraries/LibJS/Runtime/ErrorConstructor.h b/Libraries/LibJS/Runtime/ErrorConstructor.h index 4991b6b60c..f413025704 100644 --- a/Libraries/LibJS/Runtime/ErrorConstructor.h +++ b/Libraries/LibJS/Runtime/ErrorConstructor.h @@ -52,7 +52,7 @@ private: \ public: \ explicit ConstructorName(GlobalObject&); \ - virtual void initialize(GlobalObject&) override; \ + virtual void initialize(GlobalObject&) override; \ virtual ~ConstructorName() override; \ virtual Value call(Interpreter&) override; \ virtual Value construct(Interpreter&, Function& new_target) override; \ diff --git a/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Libraries/LibJS/Runtime/ErrorPrototype.cpp index 5f70f0d36d..867dee8774 100644 --- a/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -132,7 +132,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string) : Object(*global_object.error_prototype()) \ { \ } \ - PrototypeName::~PrototypeName() {} + PrototypeName::~PrototypeName() { } JS_ENUMERATE_ERROR_SUBCLASSES #undef __JS_ENUMERATE diff --git a/Libraries/LibJS/Runtime/ErrorPrototype.h b/Libraries/LibJS/Runtime/ErrorPrototype.h index 1686e6572b..0e3423b26d 100644 --- a/Libraries/LibJS/Runtime/ErrorPrototype.h +++ b/Libraries/LibJS/Runtime/ErrorPrototype.h @@ -53,7 +53,7 @@ private: \ public: \ explicit PrototypeName(GlobalObject&); \ - virtual void initialize(GlobalObject&) override { } \ + virtual void initialize(GlobalObject&) override { } \ virtual ~PrototypeName() override; \ }; diff --git a/Libraries/LibJS/Runtime/ErrorTypes.cpp b/Libraries/LibJS/Runtime/ErrorTypes.cpp index ac73e7b05e..f71172b68a 100644 --- a/Libraries/LibJS/Runtime/ErrorTypes.cpp +++ b/Libraries/LibJS/Runtime/ErrorTypes.cpp @@ -29,8 +29,8 @@ namespace JS { #define __ENUMERATE_JS_ERROR(name, message) \ -const ErrorType ErrorType::name = ErrorType(message); - JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR) + const ErrorType ErrorType::name = ErrorType(message); +JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR) #undef __ENUMERATE_JS_ERROR } diff --git a/Libraries/LibJS/Runtime/ErrorTypes.h b/Libraries/LibJS/Runtime/ErrorTypes.h index 9851a5f091..493ffc216c 100644 --- a/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Libraries/LibJS/Runtime/ErrorTypes.h @@ -26,138 +26,137 @@ #pragma once -#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(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(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(ConvertUndefinedToObject, "Cannot convert undefined to object") \ - M(DescChangeNonConfigurable, "Cannot change attributes of non-configurable property '%s'") \ - 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(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(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(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(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") \ - 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(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") \ - M(ProxyDefinePropIncompatibleDescriptor, "Proxy handler's defineProperty trap violates " \ - "invariant: the new descriptor is not compatible with the existing descriptor of the " \ - "property on the target") \ - M(ProxyDefinePropNonConfigurableNonExisting, "Proxy handler's defineProperty trap " \ - "violates invariant: a property cannot be defined as non-configurable if it does not " \ - "already exist on the target object") \ - M(ProxyDefinePropNonExtensible, "Proxy handler's defineProperty trap violates invariant: " \ - "a property cannot be reported as being defined if the property does not exist on " \ - "the target and the target is non-extensible") \ - M(ProxyDeleteNonConfigurable, "Proxy handler's deleteProperty trap violates invariant: " \ - "cannot report a non-configurable own property of the target as deleted") \ - M(ProxyGetImmutableDataProperty, "Proxy handler's get trap violates invariant: the " \ - "returned value must match the value on the target if the property exists on the " \ - "target as a non-writable, non-configurable own data property") \ - M(ProxyGetNonConfigurableAccessor, "Proxy handler's get trap violates invariant: the " \ - "returned value must be undefined if the property exists on the target as a " \ - "non-configurable accessor property with an undefined get attribute") \ - M(ProxyGetOwnDescriptorExistingConfigurable, "Proxy handler's getOwnPropertyDescriptor " \ - "trap violates invariant: a property cannot be defined as non-configurable if it " \ - "already exists on the target object as a configurable property") \ - M(ProxyGetOwnDescriptorInvalidDescriptor, "Proxy handler's getOwnPropertyDescriptor trap " \ - "violates invariant: invalid property descriptor for existing property on the target") \ - M(ProxyGetOwnDescriptorInvalidNonConfig, "Proxy handler's getOwnPropertyDescriptor trap " \ - "violates invariant: cannot report target's property as non-configurable if the " \ - "property does not exist, or if it is configurable") \ - M(ProxyGetOwnDescriptorNonConfigurable, "Proxy handler's getOwnPropertyDescriptor trap " \ - "violates invariant: cannot return undefined for a property on the target which is " \ - "a non-configurable property") \ - M(ProxyGetOwnDescriptorReturn, "Proxy handler's getOwnPropertyDescriptor trap violates " \ - "invariant: must return an object or undefined") \ - M(ProxyGetOwnDescriptorUndefReturn, "Proxy handler's getOwnPropertyDescriptor trap " \ - "violates invariant: cannot report a property as being undefined if it exists as an " \ - "own property of the target and the target is non-extensible") \ - M(ProxyGetPrototypeOfNonExtensible, "Proxy handler's getPrototypeOf trap violates " \ - "invariant: cannot return a different prototype object for a non-extensible target") \ - M(ProxyGetPrototypeOfReturn, "Proxy handler's getPrototypeOf trap violates invariant: " \ - "must return an object or null") \ - M(ProxyHasExistingNonConfigurable, "Proxy handler's has trap violates invariant: a " \ - "property cannot be reported as non-existent if it exists on the target as a " \ - "non-configurable property") \ - 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(ProxyIsExtensibleReturn, "Proxy handler's isExtensible trap violates invariant: " \ - "return value must match the target's extensibility") \ - M(ProxyPreventExtensionsReturn, "Proxy handler's preventExtensions trap violates " \ - "invariant: cannot return true if the target object is extensible") \ - M(ProxyRevoked, "An operation was performed on a revoked Proxy object") \ - M(ProxySetImmutableDataProperty, "Proxy handler's set trap violates invariant: cannot " \ - "return true for a property on the target which is a non-configurable, non-writable " \ - "own data property") \ - M(ProxySetNonConfigurableAccessor, "Proxy handler's set trap violates invariant: cannot " \ - "return true for a property on the target which is a non-configurable own accessor " \ - "property with an undefined set attribute") \ - M(ProxySetPrototypeOfNonExtensible, "Proxy handler's setPrototypeOf trap violates " \ - "invariant: the argument must match the prototype of the target if the " \ - "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(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(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(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") \ - /* 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") \ +#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(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(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(ConvertUndefinedToObject, "Cannot convert undefined to object") \ + M(DescChangeNonConfigurable, "Cannot change attributes of non-configurable property '%s'") \ + 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(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(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(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(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") \ + 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(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") \ + M(ProxyDefinePropIncompatibleDescriptor, "Proxy handler's defineProperty trap violates " \ + "invariant: the new descriptor is not compatible with the existing descriptor of the " \ + "property on the target") \ + M(ProxyDefinePropNonConfigurableNonExisting, "Proxy handler's defineProperty trap " \ + "violates invariant: a property cannot be defined as non-configurable if it does not " \ + "already exist on the target object") \ + M(ProxyDefinePropNonExtensible, "Proxy handler's defineProperty trap violates invariant: " \ + "a property cannot be reported as being defined if the property does not exist on " \ + "the target and the target is non-extensible") \ + M(ProxyDeleteNonConfigurable, "Proxy handler's deleteProperty trap violates invariant: " \ + "cannot report a non-configurable own property of the target as deleted") \ + M(ProxyGetImmutableDataProperty, "Proxy handler's get trap violates invariant: the " \ + "returned value must match the value on the target if the property exists on the " \ + "target as a non-writable, non-configurable own data property") \ + M(ProxyGetNonConfigurableAccessor, "Proxy handler's get trap violates invariant: the " \ + "returned value must be undefined if the property exists on the target as a " \ + "non-configurable accessor property with an undefined get attribute") \ + M(ProxyGetOwnDescriptorExistingConfigurable, "Proxy handler's getOwnPropertyDescriptor " \ + "trap violates invariant: a property cannot be defined as non-configurable if it " \ + "already exists on the target object as a configurable property") \ + M(ProxyGetOwnDescriptorInvalidDescriptor, "Proxy handler's getOwnPropertyDescriptor trap " \ + "violates invariant: invalid property descriptor for existing property on the target") \ + M(ProxyGetOwnDescriptorInvalidNonConfig, "Proxy handler's getOwnPropertyDescriptor trap " \ + "violates invariant: cannot report target's property as non-configurable if the " \ + "property does not exist, or if it is configurable") \ + M(ProxyGetOwnDescriptorNonConfigurable, "Proxy handler's getOwnPropertyDescriptor trap " \ + "violates invariant: cannot return undefined for a property on the target which is " \ + "a non-configurable property") \ + M(ProxyGetOwnDescriptorReturn, "Proxy handler's getOwnPropertyDescriptor trap violates " \ + "invariant: must return an object or undefined") \ + M(ProxyGetOwnDescriptorUndefReturn, "Proxy handler's getOwnPropertyDescriptor trap " \ + "violates invariant: cannot report a property as being undefined if it exists as an " \ + "own property of the target and the target is non-extensible") \ + M(ProxyGetPrototypeOfNonExtensible, "Proxy handler's getPrototypeOf trap violates " \ + "invariant: cannot return a different prototype object for a non-extensible target") \ + M(ProxyGetPrototypeOfReturn, "Proxy handler's getPrototypeOf trap violates invariant: " \ + "must return an object or null") \ + M(ProxyHasExistingNonConfigurable, "Proxy handler's has trap violates invariant: a " \ + "property cannot be reported as non-existent if it exists on the target as a " \ + "non-configurable property") \ + 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(ProxyIsExtensibleReturn, "Proxy handler's isExtensible trap violates invariant: " \ + "return value must match the target's extensibility") \ + M(ProxyPreventExtensionsReturn, "Proxy handler's preventExtensions trap violates " \ + "invariant: cannot return true if the target object is extensible") \ + M(ProxyRevoked, "An operation was performed on a revoked Proxy object") \ + M(ProxySetImmutableDataProperty, "Proxy handler's set trap violates invariant: cannot " \ + "return true for a property on the target which is a non-configurable, non-writable " \ + "own data property") \ + M(ProxySetNonConfigurableAccessor, "Proxy handler's set trap violates invariant: cannot " \ + "return true for a property on the target which is a non-configurable own accessor " \ + "property with an undefined set attribute") \ + M(ProxySetPrototypeOfNonExtensible, "Proxy handler's setPrototypeOf trap violates " \ + "invariant: the argument must match the prototype of the target if the " \ + "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(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(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(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") \ + /* 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") - namespace JS { class ErrorType { @@ -167,7 +166,10 @@ public: JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR) #undef __ENUMERATE_JS_ERROR - const char* message() const { return m_message; }; + const char* message() const + { + return m_message; + } private: explicit ErrorType(const char* message) @@ -179,4 +181,3 @@ private: }; } - diff --git a/Libraries/LibJS/Runtime/GlobalObject.h b/Libraries/LibJS/Runtime/GlobalObject.h index 7b39ef9b9a..ac989a2f6f 100644 --- a/Libraries/LibJS/Runtime/GlobalObject.h +++ b/Libraries/LibJS/Runtime/GlobalObject.h @@ -78,7 +78,6 @@ private: Object* m_##snake_name##_prototype { nullptr }; JS_ENUMERATE_ITERATOR_PROTOTYPES #undef __JS_ENUMERATE - }; template<typename ConstructorType> diff --git a/Libraries/LibJS/Runtime/NumberPrototype.cpp b/Libraries/LibJS/Runtime/NumberPrototype.cpp index 0f7b0c8e3b..5f2d92e8df 100644 --- a/Libraries/LibJS/Runtime/NumberPrototype.cpp +++ b/Libraries/LibJS/Runtime/NumberPrototype.cpp @@ -33,10 +33,12 @@ namespace JS { static const u8 max_precision_for_radix[37] = { + // clang-format off 0, 0, 52, 32, 26, 22, 20, 18, 17, 16, 15, 15, 14, 14, 13, 13, 13, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + // clang-format on }; static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; diff --git a/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 1d94f69a91..7885561c61 100644 --- a/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -81,7 +81,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::to_string) String tag; auto to_string_tag = this_object->get(global_object.vm().well_known_symbol_to_string_tag()); - + if (to_string_tag.is_string()) { tag = to_string_tag.as_string().string(); } else if (this_object->is_array()) { diff --git a/Libraries/LibJS/Runtime/PropertyAttributes.h b/Libraries/LibJS/Runtime/PropertyAttributes.h index d99f074eac..d2fbe50ad7 100644 --- a/Libraries/LibJS/Runtime/PropertyAttributes.h +++ b/Libraries/LibJS/Runtime/PropertyAttributes.h @@ -26,8 +26,8 @@ #pragma once -#include <AK/Types.h> #include <AK/LogStream.h> +#include <AK/Types.h> namespace JS { diff --git a/Libraries/LibJS/Runtime/RegExpObject.cpp b/Libraries/LibJS/Runtime/RegExpObject.cpp index c9bd9da6b1..34637e398b 100644 --- a/Libraries/LibJS/Runtime/RegExpObject.cpp +++ b/Libraries/LibJS/Runtime/RegExpObject.cpp @@ -32,7 +32,6 @@ #include <LibJS/Runtime/RegExpObject.h> #include <LibJS/Runtime/Value.h> - namespace JS { RegExpObject* RegExpObject::create(GlobalObject& global_object, String content, String flags) diff --git a/Libraries/LibJS/Runtime/StringIterator.cpp b/Libraries/LibJS/Runtime/StringIterator.cpp index 44df424217..4c0b9a3355 100644 --- a/Libraries/LibJS/Runtime/StringIterator.cpp +++ b/Libraries/LibJS/Runtime/StringIterator.cpp @@ -25,8 +25,8 @@ */ #include <AK/Utf8View.h> -#include <LibJS/Runtime/StringIterator.h> #include <LibJS/Runtime/GlobalObject.h> +#include <LibJS/Runtime/StringIterator.h> namespace JS { diff --git a/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp b/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp index 7d3dd45755..05f10c88df 100644 --- a/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp +++ b/Libraries/LibJS/Runtime/StringIteratorPrototype.cpp @@ -25,11 +25,11 @@ */ #include <AK/StringBuilder.h> -#include <LibJS/Runtime/StringIterator.h> -#include <LibJS/Runtime/StringIteratorPrototype.h> #include <LibJS/Runtime/Error.h> #include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/IteratorOperations.h> +#include <LibJS/Runtime/StringIterator.h> +#include <LibJS/Runtime/StringIteratorPrototype.h> namespace JS { diff --git a/Libraries/LibJS/Runtime/StringPrototype.cpp b/Libraries/LibJS/Runtime/StringPrototype.cpp index 6944ec9a61..10a2e2ff71 100644 --- a/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -32,8 +32,8 @@ #include <LibJS/Runtime/Error.h> #include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/PrimitiveString.h> -#include <LibJS/Runtime/StringObject.h> #include <LibJS/Runtime/StringIterator.h> +#include <LibJS/Runtime/StringObject.h> #include <LibJS/Runtime/StringPrototype.h> #include <LibJS/Runtime/Value.h> #include <string.h> diff --git a/Libraries/LibJS/Runtime/SymbolObject.cpp b/Libraries/LibJS/Runtime/SymbolObject.cpp index f04f1fdee6..1a58d75eac 100644 --- a/Libraries/LibJS/Runtime/SymbolObject.cpp +++ b/Libraries/LibJS/Runtime/SymbolObject.cpp @@ -34,7 +34,6 @@ namespace JS { - SymbolObject* SymbolObject::create(GlobalObject& global_object, Symbol& primitive_symbol) { return global_object.heap().allocate<SymbolObject>(global_object, primitive_symbol, *global_object.symbol_prototype()); |