Linus Groh
5e72fde954
LibJS: Unify Symbol::description() and raw_description()
...
Let callers take care of handling the empty optional case (undefined in
the spec).
2023-02-11 21:47:57 +00:00
Andreas Kling
4abdb68655
LibJS: Remove Object(Object& prototype) footgun
...
This constructor was easily confused with a copy constructor, and it was
possible to accidentally copy-construct Objects in at least one way that
we dicovered (via generic ThrowCompletionOr construction).
This patch adds a mandatory ConstructWithPrototypeTag parameter to the
constructor to disambiguate it.
2022-12-14 15:11:57 +01:00
Linus Groh
525f22d018
LibJS: Replace standalone js_string() with PrimitiveString::create()
...
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
2022-12-07 16:43:06 +00:00
Linus Groh
6e19ab2bbc
AK+Everywhere: Rename String to DeprecatedString
...
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Andreas Kling
b81816a539
LibJS+LibWeb: Make CyclicModule.h not include AST.h
...
This led to some fallout as many things in LibJS and LibWeb were pulling
in other things via CyclicModule.h
2022-11-23 16:05:59 +00:00
Linus Groh
ecd163bdf1
LibJS+LibWeb: Replace GlobalObject with Realm in object constructors
...
No functional changes - we can still very easily get to the global
object via `Realm::global_object()`. This is in preparation of moving
the intrinsics to the realm and no longer having to pass a global
object when allocating any object.
In a few (now, and many more in subsequent commits) places we get a
realm using `GlobalObject::associated_realm()`, this is intended to be
temporary. For example, create() functions will later receive the same
treatment and are passed a realm instead of a global object.
2022-08-23 13:58:30 +01:00
Linus Groh
9f3f3b0864
LibJS: Remove implicit wrapping/unwrapping of completion records
...
This is an editorial change in the ECMA-262 spec, with similar changes
in some proposals.
See:
- https://github.com/tc39/ecma262/commit/7575f74
- https://github.com/tc39/proposal-array-grouping/commit/df899eb
- https://github.com/tc39/proposal-shadowrealm/commit/9eb5a12
- https://github.com/tc39/proposal-shadowrealm/commit/c81f527
2022-05-03 01:09:29 +02:00
Lenny Maiorani
d00b79568f
Libraries: Use default constructors/destructors in LibJS
...
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-16 16:19:40 +00:00
Linus Groh
e657e88ed6
LibJS: Add [[InitialName]] and use it in Function.prototype.toString()
2022-02-20 23:21:40 +00:00
Linus Groh
93372e0a0d
LibJS: Remove unused BoundFunction.h include from FunctionObject.cpp
2022-02-20 15:40:40 +00:00
Linus Groh
87b9fa2636
LibJS: Add FunctionObject constructor allowing null prototype
...
This just calls through to the Object constructor added in the previous
commit.
2022-02-09 23:31:34 +00:00
Linus Groh
f663c7d6da
LibJS: Remove unused BoundFunction::m_constructor_prototype
...
This was not being used anywhere, and the way we determined it was not
matching the spec at all, so let's remove it and do it properly.
2022-02-09 23:31:34 +00:00
Linus Groh
886d6c62f9
LibJS: Implement the SetFunctionLength AO
2022-01-24 20:17:07 +00:00
Linus Groh
5b04c49762
LibJS: Implement the SetFunctionName AO
2022-01-24 20:17:07 +00:00
Linus Groh
62356cff40
LibJS: Convert FunctionObject::bind() to ThrowCompletionOr
2022-01-04 23:37:26 +00:00
Linus Groh
0881f8160f
LibJS: Use implicit ThrowCompletionOr<T> constructor where possible
...
Luckily this is not very widespread yet as most of it would happen in
the various JS functions instead of AOs.
2021-10-21 09:02:23 +01:00
Linus Groh
52976bfac6
LibJS: Convert to_object() to ThrowCompletionOr
2021-10-13 09:55:10 +01:00
Linus Groh
b7e5f08e56
LibJS: Convert Object::get() to ThrowCompletionOr
...
To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
2021-10-03 20:14:03 +01:00
Linus Groh
9043041dd3
LibJS: Move [[BoundThis]] and [[BoundArguments]] to BoundFunction
2021-09-25 17:51:30 +02:00
Linus Groh
4566472ed6
LibJS: Rename BoundFunction::m_target_function to match spec name
2021-09-25 17:51:30 +02:00
Linus Groh
76eb8fe717
LibJS: Move [[Fields]] to ECMAScriptFunctionObject
2021-09-25 17:51:30 +02:00
Linus Groh
136451c3af
LibJS: Move [[HomeObject]] to ECMAScriptFunctionObject
2021-09-25 17:51:30 +02:00
Idan Horowitz
ab594e5f2f
LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr
2021-09-23 23:59:13 +03:00
Andreas Kling
d42d655853
LibJS+LibWeb+Spreadsheet: Upcall visit_edges() via Base typedef
...
Let's use Base::visit_edges() when calling the base class, to prevent
accidentally skipping over anyone in the inheritance chain.
2021-09-11 14:10:11 +02:00
Andreas Kling
466649c1e8
LibJS: Mark instance field names in FunctionObject::visit_edges()
2021-09-11 14:10:11 +02:00
davidot
def8b44c40
LibJS: Add support for public fields in classes
2021-09-01 13:39:14 +01:00
Andreas Kling
ba9d5c4d54
LibJS: Rename Function => FunctionObject
2021-06-27 22:36:04 +02:00