1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00
serenity/Libraries/LibJS
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
..
Heap LibJS: Use __APPLE__ instead of __MACH__ for MacOS build 2020-05-23 18:09:07 +02:00
Runtime LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
Tests LibJS: Add Array.prototype.fill 2020-05-26 20:34:44 +02:00
AST.cpp LibJS: Simplify and normalize publicly-exposed Object functions 2020-05-27 13:17:35 +02:00
AST.h LibJS: Fix style inconsistencies in AST.h (#2403) 2020-05-26 19:52:03 +02:00
CMakeLists.txt LibJS: Create JS to HTML markup generator 2020-05-26 10:17:50 +02:00
Console.cpp LibJS: Add side-effect-free version of Value::to_string() 2020-05-15 13:50:42 +02:00
Console.h LibJS: Implement ConsoleClient 2020-05-05 09:15:16 +02:00
Forward.h LibJS: Create JS to HTML markup generator 2020-05-26 10:17:50 +02:00
Interpreter.cpp LibJS: Only log exception throw information on Serenity 2020-05-26 14:36:30 +02:00
Interpreter.h Browser: Add JS Console 2020-05-24 02:20:08 +02:00
Lexer.cpp LibJS: Fix incorrect token column values (#2401) 2020-05-26 19:00:30 +02:00
Lexer.h LibJS: Fix incorrect token column values (#2401) 2020-05-26 19:00:30 +02:00
MarkupGenerator.cpp LibJS: Fix incorrect token column values (#2401) 2020-05-26 19:00:30 +02:00
MarkupGenerator.h Browser: Add output styles to JS source printed in the console 2020-05-26 10:17:50 +02:00
Parser.cpp LibJS: Implement basic for..in and for..of loops 2020-05-25 18:45:36 +02:00
Parser.h LibJS: Add Error::source_location_hint() 2020-05-26 14:36:30 +02:00
Token.cpp LibJS: Handle hex and unicode escape sequences in string literals 2020-05-18 17:58:17 +02:00
Token.h LibJS: Handle hex and unicode escape sequences in string literals 2020-05-18 17:58:17 +02:00