1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-13 15:21:00 +00:00
serenity/Libraries/LibJS/Runtime
Linus Groh 9ea6ef4ed1 LibJS: Make Interpreter::throw_exception() a void function
The motivation for this change is twofold:

- Returning a JS::Value is misleading as one would expect it to carry
  some meaningful information, like maybe the error object that's being
  created, but in fact it is always empty. Supposedly to serve as a
  shortcut for the common case of "throw and return empty value", but
  that's just leading us to my second point.
- Inconsistent usage / coding style: as of this commit there are 114
  uses of throw_exception() discarding its return value and 55 uses
  directly returning the call result (in LibJS, not counting LibWeb);
  with the first style often having a more explicit empty value (or
  nullptr in some cases) return anyway.
  One more line to always make the return value obvious is should be
  worth it.

So now it's basically always these steps, which is already being used in
the majority of cases (as outlined above):

- Throw an exception. This mutates interpreter state by updating
  m_exception and unwinding, but doesn't return anything.
- Let the caller explicitly return an empty value, nullptr or anything
  else itself.
2020-08-25 18:30:31 +02:00
..
Accessor.h LibJS+LibWeb: Clear exceptions after call'ing JavaScript functions 2020-08-14 17:31:07 +02:00
Array.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
Array.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
ArrayConstructor.cpp LibJS: Implement basic functionality of Array.from() 2020-08-17 21:23:11 +02:00
ArrayConstructor.h LibJS: Implement basic functionality of Array.from() 2020-08-17 21:23:11 +02:00
ArrayIterator.cpp LibJS: Add StringIterator 2020-07-13 15:07:29 +02:00
ArrayIterator.h LibJS: Start implementing iterable framework, add ArrayIterator 2020-07-11 18:54:13 +02:00
ArrayIteratorPrototype.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ArrayIteratorPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ArrayPrototype.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ArrayPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BigInt.cpp LibJS: Use allocate_without_global_object for primitive cell types 2020-07-25 13:12:17 +02:00
BigInt.h LibJS: Add BigInt 2020-06-07 19:29:40 +02:00
BigIntConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BigIntConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BigIntObject.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
BigIntObject.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
BigIntPrototype.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BigIntPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BooleanConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BooleanConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BooleanObject.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
BooleanObject.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
BooleanPrototype.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BooleanPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BoundFunction.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
BoundFunction.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
Cell.cpp LibJS: Implement correct object property ordering 2020-04-29 18:47:03 +02:00
Cell.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ConsoleObject.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ConsoleObject.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
Date.cpp LibJS: Make Date.getUTCSeconds() call through to LibC 2020-08-24 18:21:16 +02:00
Date.h LibJS: Make Date.getUTCSeconds() call through to LibC 2020-08-24 18:21:16 +02:00
DateConstructor.cpp LibJS: Make Date's tuple constructor correctly handle out-of-range arguments 2020-08-24 18:20:07 +02:00
DateConstructor.h LibJS: Implement Date.parse() 2020-08-21 21:12:54 +02:00
DatePrototype.cpp LibJS: Implement Date.getUTC* 2020-08-23 22:00:05 +02:00
DatePrototype.h LibJS: Implement Date.getUTC* 2020-08-23 22:00:05 +02:00
Error.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
Error.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
ErrorConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ErrorConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ErrorPrototype.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ErrorPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ErrorTypes.cpp LibJS: Consolidate error messages into ErrorTypes.h 2020-06-11 07:46:20 +02:00
ErrorTypes.h LibWeb: Make btoa() and atob() correctly handle values between 128 and 255 2020-07-22 19:22:00 +02:00
Exception.cpp LibJS: Store basic traceback in Exception 2020-06-02 15:22:34 +02:00
Exception.h LibJS: Store basic traceback in Exception 2020-06-02 15:22:34 +02:00
Function.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
Function.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
FunctionConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
FunctionConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
FunctionPrototype.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
FunctionPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
GlobalObject.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
GlobalObject.h LibJS: Start implementing iterable framework, add ArrayIterator 2020-07-11 18:54:13 +02:00
IndexedProperties.cpp LibJS: Distinguish between omitted descriptor attributes and false ones 2020-06-06 22:13:01 +02:00
IndexedProperties.h LibJS: Distinguish between omitted descriptor attributes and false ones 2020-06-06 22:13:01 +02:00
IteratorOperations.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
IteratorOperations.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
IteratorPrototype.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
IteratorPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
JSONObject.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
JSONObject.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
LexicalEnvironment.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
LexicalEnvironment.h LibJS: Initial class implementation; allow super expressions in object 2020-06-29 17:54:54 +02:00
MarkedValueList.cpp LibJS: run clang-format on all the files 2020-05-05 09:15:16 +02:00
MarkedValueList.h LibJS: Add MarkedValueList and use it for argument passing 2020-04-19 17:34:33 +02:00
MathObject.cpp LibJS: The Math.ceil() of a number between -1 and 0 should be -0, 2020-08-04 11:31:11 +02:00
MathObject.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
NativeFunction.cpp LibJS: Explicitly pass a "Function& new_target" to Function::construct 2020-07-01 11:16:37 +02:00
NativeFunction.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
NativeProperty.cpp LibJS: Make NativeProperty a plain Cell instead of an Object 2020-06-23 17:56:57 +02:00
NativeProperty.h LibJS: Make NativeProperty a plain Cell instead of an Object 2020-06-23 17:56:57 +02:00
NumberConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
NumberConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
NumberObject.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
NumberObject.h LibJS: Add Number.prototype.toString 2020-07-15 18:24:55 +02:00
NumberPrototype.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
NumberPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
Object.cpp LibJS+LibWeb: Clear exceptions after call'ing JavaScript functions 2020-08-14 17:31:07 +02:00
Object.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ObjectConstructor.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ObjectConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ObjectPrototype.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ObjectPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
PrimitiveString.cpp LibJS: Use allocate_without_global_object for primitive cell types 2020-07-25 13:12:17 +02:00
PrimitiveString.h LibJS: Add js_string(Interpreter&, String) 2020-04-04 12:58:05 +02:00
PropertyAttributes.cpp LibJS: Add Proxy objects 2020-06-06 22:13:01 +02:00
PropertyAttributes.h LibJS: Add Proxy objects 2020-06-06 22:13:01 +02:00
PropertyName.h LibJS: Integrate Symbols into objects as valid keys 2020-07-09 23:33:00 +02:00
ProxyConstructor.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ProxyConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
ProxyObject.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ProxyObject.h LibJS: Implement spec-compliant Object.prototype.toString 2020-07-11 23:13:29 +02:00
ProxyPrototype.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
ProxyPrototype.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
Reference.cpp LibJS: Pass GlobalObject& to Reference get/put 2020-06-20 17:50:48 +02:00
Reference.h LibJS: Pass GlobalObject& to Reference get/put 2020-06-20 17:50:48 +02:00
ReflectObject.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ReflectObject.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
RegExpConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
RegExpConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
RegExpObject.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
RegExpObject.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
RegExpPrototype.cpp LibJS: Move native objects towards two-pass construction 2020-06-20 15:46:30 +02:00
RegExpPrototype.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
ScriptFunction.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
ScriptFunction.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
Shape.cpp LibJS: Integrate Symbols into objects as valid keys 2020-07-09 23:33:00 +02:00
Shape.h LibJS: Integrate Symbols into objects as valid keys 2020-07-09 23:33:00 +02:00
StringConstructor.cpp LibJS: Allow conversion from Symbol to String via explicit String() call 2020-08-22 10:52:40 +02:00
StringConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
StringIterator.cpp LibJS: Add StringIterator 2020-07-13 15:07:29 +02:00
StringIterator.h LibJS: Add StringIterator 2020-07-13 15:07:29 +02:00
StringIteratorPrototype.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
StringIteratorPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
StringObject.cpp LibJS: Clarify Object (base class) construction somewhat 2020-06-23 17:21:53 +02:00
StringObject.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
StringOrSymbol.h LibJS: Make StringOrSymbol not leak strings 2020-08-16 20:31:05 +02:00
StringPrototype.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
StringPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
Symbol.cpp LibJS: Use allocate_without_global_object for primitive cell types 2020-07-25 13:12:17 +02:00
Symbol.h LibJS: Integrate Symbols into objects as valid keys 2020-07-09 23:33:00 +02:00
SymbolConstructor.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
SymbolConstructor.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
SymbolObject.cpp LibJS: Move global symbol map from SymbolObject to Interpreter 2020-07-09 23:29:28 +02:00
SymbolObject.h LibJS: Move global symbol map from SymbolObject to Interpreter 2020-07-09 23:29:28 +02:00
SymbolPrototype.cpp LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
SymbolPrototype.h LibJS: Simplify Cell::initialize() 2020-07-23 17:31:08 +02:00
Uint8ClampedArray.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
Uint8ClampedArray.h LibJS+LibWeb: Add JS::Object::inherits(class_name) 2020-06-21 15:15:52 +02:00
Value.cpp LibJS: Make Interpreter::throw_exception() a void function 2020-08-25 18:30:31 +02:00
Value.h LibJS: Implement spec-complient instance_of operation 2020-07-14 20:15:19 +02:00