mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Issue #2142 - Implement syntax for public/private fields and computed field names
This state still has the initializers scoped on .initializers local variable, which will be changed later.
Based-on: m-c 1499448, 1530084, 1530832, 1529448 (partial), 1532921, 1528039, 1528038, 1535166, 1550628,
1535166, 1550628, 1541641, 1547133, 1540787, 1535804/9
This commit is contained in:
parent
afa7bddc96
commit
51db22ff2f
24 changed files with 1383 additions and 290 deletions
|
|
@ -1999,11 +1999,39 @@ static_assert(sizeof(JSScript) % js::gc::CellSize == 0,
|
|||
|
||||
namespace js {
|
||||
|
||||
struct FieldInitializers
|
||||
{
|
||||
#ifdef DEBUG
|
||||
bool valid;
|
||||
#endif
|
||||
// This struct will eventually have a vector of constant values for optimizing
|
||||
// field initializers.
|
||||
size_t numFieldInitializers;
|
||||
|
||||
explicit FieldInitializers(size_t numFieldInitializers)
|
||||
:
|
||||
#ifdef DEBUG
|
||||
valid(true),
|
||||
#endif
|
||||
numFieldInitializers(numFieldInitializers) {
|
||||
}
|
||||
|
||||
static FieldInitializers Invalid() { return FieldInitializers(); }
|
||||
|
||||
private:
|
||||
FieldInitializers()
|
||||
:
|
||||
#ifdef DEBUG
|
||||
valid(false),
|
||||
#endif
|
||||
numFieldInitializers(0) {
|
||||
}
|
||||
};
|
||||
|
||||
// Information about a script which may be (or has been) lazily compiled to
|
||||
// bytecode from its source.
|
||||
class LazyScript : public gc::TenuredCell
|
||||
{
|
||||
private:
|
||||
// If non-nullptr, the script has been compiled and this is a forwarding
|
||||
// pointer to the result. This is a weak pointer: after relazification, we
|
||||
// can collect the script if there are no other pointers to it.
|
||||
|
|
@ -2030,7 +2058,6 @@ class LazyScript : public gc::TenuredCell
|
|||
uint32_t padding;
|
||||
#endif
|
||||
|
||||
private:
|
||||
static const uint32_t NumClosedOverBindingsBits = 20;
|
||||
static const uint32_t NumInnerFunctionsBits = 20;
|
||||
|
||||
|
|
@ -2072,6 +2099,8 @@ class LazyScript : public gc::TenuredCell
|
|||
uint64_t packedFields_;
|
||||
};
|
||||
|
||||
FieldInitializers fieldInitializers_;
|
||||
|
||||
// Source location for the script.
|
||||
// See the comment in JSScript for the details.
|
||||
uint32_t begin_;
|
||||
|
|
@ -2297,6 +2326,12 @@ class LazyScript : public gc::TenuredCell
|
|||
p_.hasThisBinding = true;
|
||||
}
|
||||
|
||||
void setFieldInitializers(FieldInitializers fieldInitializers) {
|
||||
fieldInitializers_ = fieldInitializers;
|
||||
}
|
||||
|
||||
FieldInitializers getFieldInitializers() const { return fieldInitializers_; }
|
||||
|
||||
const char* filename() const {
|
||||
return scriptSource()->filename();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue