Issue #2236 - Fix import.meta module error in lambdas by moving parseGoal() into SharedContext. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1604792 Also remove ParseGoal being passed through Parser introduced in #1691 Part 2.

This commit is contained in:
Brian Smith 2023-05-08 18:28:18 -05:00 committed by roytam1
commit 1c70f64e7c
10 changed files with 63 additions and 45 deletions

View file

@ -2108,7 +2108,7 @@ class LazyScript : public gc::TenuredCell
uint32_t isFieldInitializer : 1;
uint32_t needsHomeObject : 1;
uint32_t hasRest : 1;
uint32_t parseGoal : 1;
uint32_t hasModuleGoal : 1;
};
union {
@ -2150,8 +2150,7 @@ class LazyScript : public gc::TenuredCell
const frontend::AtomVector& closedOverBindings,
Handle<GCVector<JSFunction*, 8>> innerFunctions,
JSVersion version, uint32_t begin, uint32_t end,
uint32_t toStringStart, uint32_t lineno, uint32_t column,
frontend::ParseGoal parseGoal);
uint32_t toStringStart, uint32_t lineno, uint32_t column);
// Create a LazyScript and initialize the closedOverBindings and the
// innerFunctions with dummy values to be replaced in a later initialization
@ -2262,8 +2261,20 @@ class LazyScript : public gc::TenuredCell
p_.isExprBody = true;
}
frontend::ParseGoal parseGoal() const {
return frontend::ParseGoal(p_.parseGoal);
// This was added in Issue #2236 to compensate for the lack of
// Mozilla's ImmutableFlags feature, if ImmutableFlags ever gets
// ported remove the next 2 methods.
bool hasModuleGoal() const {
return p_.hasModuleGoal;
}
void setHasModuleGoal() {
p_.hasModuleGoal = true;
}
js::frontend::ParseGoal parseGoal() const {
return hasModuleGoal() ? js::frontend::ParseGoal::Module
: js::frontend::ParseGoal::Script;
}
bool strict() const {