1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00
serenity/Libraries/LibJS/Runtime
Matthew Olsson dd08c992e8 LibJS: Simplify and normalize publicly-exposed Object functions
Previously, the Object class had many different types of functions for
each action. For example: get_by_index, get(PropertyName),
get(FlyString). This is a bit verbose, so these methods have been
shortened to simply use the PropertyName structure. The methods then
internally call _by_index if necessary. Note that the _by_index
have been made private to enforce this change.

Secondly, a clear distinction has been made between "putting" and
"defining" an object property. "Putting" should mean modifying a
(potentially) already existing property. This is akin to doing "a.b =
'foo'".

This implies two things about put operations:
    - They will search the prototype chain for setters and call them, if
      necessary.
    - If no property exists with a particular key, the put operation
      should create a new property with the default attributes
      (configurable, writable, and enumerable).

In contrast, "defining" a property should completely overwrite any
existing value without calling setters (if that property is
configurable, of course).

Thus, all of the many JS objects have had any "put" calls changed to
"define_property" calls. Additionally, "put_native_function" and
"put_native_property" have had their "put" replaced with "define".

Finally, "put_own_property" has been made private, as all necessary
functionality should be exposed with the put and define_property
methods.
2020-05-27 13:17:35 +02:00
..
Accessor.h LibJS: Refactor Accessor 2020-05-24 18:49:58 +02:00
Array.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
Array.h LibJS: Implement Array length setter 2020-04-23 09:47:23 +02:00
ArrayConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ArrayConstructor.h LibJS: Add Array.of() 2020-05-08 20:06:49 +02:00
ArrayPrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ArrayPrototype.h LibJS: Add Array.prototype.fill 2020-05-26 20:34:44 +02:00
BooleanConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
BooleanConstructor.h LibJS: Reformat BooleanConstructor.{cpp,h} 2020-04-07 17:25:50 +02:00
BooleanObject.cpp LibJS: Move builtin prototypes to the global object 2020-04-18 13:24:45 +02:00
BooleanObject.h LibJS: Pass prototype to BooleanObject constructor 2020-04-18 10:28:22 +02:00
BooleanPrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
BooleanPrototype.h LibJS: Boolean, Number and String prototypes should have values too 2020-04-10 13:09:35 +02:00
BoundFunction.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
BoundFunction.h LibJS: Implement Function.prototype.bind() 2020-04-21 12:23:07 +02:00
Cell.cpp LibJS: Implement correct object property ordering 2020-04-29 18:47:03 +02:00
Cell.h LibJS: Implement correct object property ordering 2020-04-29 18:47:03 +02:00
ConsoleObject.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ConsoleObject.h LibJS: Add ConsoleMessage concept 2020-05-02 11:41:35 +02:00
Date.cpp LibJS: Move builtin prototypes to the global object 2020-04-18 13:24:45 +02:00
Date.h LibJS: Pass prototype to Date constructor 2020-04-18 10:28:22 +02:00
DateConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
DateConstructor.h LibJS: Implement constructor/non-constructor function calls 2020-04-01 20:18:36 +02:00
DatePrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
DatePrototype.h LibJS: Implement Date.prototype.to{Date,Time}String() 2020-03-30 21:43:35 +02:00
Error.cpp LibJS: run clang-format on all the files 2020-05-05 09:15:16 +02:00
Error.h LibJS: Pass prototype to Error constructors 2020-04-18 10:28:22 +02:00
ErrorConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ErrorConstructor.h LibJS: Use enumerator macros for boilerplate code around native types 2020-04-10 14:06:52 +02:00
ErrorPrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ErrorPrototype.h LibJS: Implement Error.prototype.name setter (#1776) 2020-04-13 11:19:53 +02:00
Exception.cpp LibJS: Implement "throw" 2020-03-24 22:21:58 +01:00
Exception.h LibJS: Implement "throw" 2020-03-24 22:21:58 +01:00
Function.cpp LibJS: Rename to_{i32,size_t}() to as_{i32,size_t}() for clarity 2020-05-18 10:21:51 +02:00
Function.h LibJS: Don't use Optional<Value> for bound |this| values 2020-04-29 12:41:58 +02:00
FunctionConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
FunctionConstructor.h LibJS: Add Function() and Function.prototype 2020-04-04 15:58:49 +02:00
FunctionPrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
FunctionPrototype.h LibJS: Pass prototype to Function constructors 2020-04-18 10:28:22 +02:00
GlobalObject.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
GlobalObject.h LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
LexicalEnvironment.cpp LibJS: Allow cells to mark null pointers 2020-04-16 16:10:38 +02:00
LexicalEnvironment.h LibJS: Introduce LexicalEnvironment 2020-04-15 22:07:20 +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: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
MathObject.h LibJS: Add Math.clz32() 2020-05-18 17:57:28 +02:00
NativeFunction.cpp LibJS: Move builtin prototypes to the global object 2020-04-18 13:24:45 +02:00
NativeFunction.h LibJS: Pass prototype to Function constructors 2020-04-18 10:28:22 +02:00
NativeProperty.cpp LibJS+LibWeb: Pass prototype to Object constructor 2020-04-18 11:00:55 +02:00
NativeProperty.h LibJS+LibWeb: Move native properties to separate getters/setters 2020-03-29 00:37:33 +01:00
NumberConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
NumberConstructor.h LibJS: Implement Number.isInteger() 2020-04-26 20:36:59 +02:00
NumberObject.cpp LibJS: Move builtin prototypes to the global object 2020-04-18 13:24:45 +02:00
NumberObject.h LibJS: Pass prototype to NumberObject constructor 2020-04-18 10:28:22 +02:00
NumberPrototype.cpp LibJS: Move builtin prototypes to the global object 2020-04-18 13:24:45 +02:00
NumberPrototype.h LibJS: Boolean, Number and String prototypes should have values too 2020-04-10 13:09:35 +02:00
Object.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
Object.h LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ObjectConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ObjectConstructor.h LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ObjectPrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ObjectPrototype.h LibJS: Make Array.prototype.{join,toString}() generic 2020-05-22 17:43:44 +02:00
PrimitiveString.cpp LibJS: Add js_string(Interpreter&, String) 2020-04-04 12:58:05 +02:00
PrimitiveString.h LibJS: Add js_string(Interpreter&, String) 2020-04-04 12:58:05 +02:00
PropertyName.h LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
Reference.cpp LibJS: Change Value::to_object(Heap& -> Interpreter&) 2020-05-18 09:39:55 +02:00
Reference.h LibJS: Support o.f++ :^) 2020-04-28 15:07:08 +02:00
ReflectObject.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ReflectObject.h LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
ScriptFunction.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
ScriptFunction.h LibJS: Function.length respects default and rest parameters 2020-05-06 17:40:56 +02:00
Shape.cpp LibJS: Implement correct object property ordering 2020-04-29 18:47:03 +02:00
Shape.h LibJS: Add getter/setter support 2020-05-21 22:56:18 +02:00
StringConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
StringConstructor.h LibJS: Add String.raw 2020-05-07 23:05:55 +02:00
StringObject.cpp LibJS: Move builtin prototypes to the global object 2020-04-18 13:24:45 +02:00
StringObject.h LibJS: Make StringObject::primitive_string() return a reference 2020-04-29 12:33:28 +02:00
StringPrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
StringPrototype.h LibJS: Add String.prototype.lastIndexOf 2020-05-01 16:50:37 +02:00
Symbol.cpp LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
Symbol.h LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
SymbolConstructor.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
SymbolConstructor.h LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
SymbolObject.cpp LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
SymbolObject.h LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
SymbolPrototype.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
SymbolPrototype.h LibJS: Remove no-op SymbolPrototype::description_setter() 2020-05-18 09:36:14 +02:00
Uint8ClampedArray.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
Uint8ClampedArray.h LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
Value.cpp LibJS: Treat NaN in Value::to_i32() as zero 2020-05-23 16:39:17 +02:00
Value.h LibJS: Make Array.prototype.push() generic 2020-05-22 17:43:44 +02:00