Bug 1634519 - Removing uses of FunctionBox::function. r=mgaudet

Differential Revision: https://phabricator.services.mozilla.com/D73336
This commit is contained in:
Ted Campbell 2020-04-30 20:25:56 +00:00
Родитель 0dd3332a55
Коммит 02b8648f33
2 изменённых файлов: 7 добавлений и 26 удалений

Просмотреть файл

@ -7192,6 +7192,10 @@ bool GeneralParser<ParseHandler, Unit>::finishClassConstructor(
}
if (FunctionBox* ctorbox = classStmt.constructorBox) {
// The ctorbox must not have emitted a JSFunction yet since we are still
// updating it.
MOZ_ASSERT(!ctorbox->hasFunction());
// Amend the toStringEnd offset for the constructor now that we've
// finished parsing the class.
ctorbox->extent.toStringEnd = classEndOffset;
@ -7200,20 +7204,6 @@ bool GeneralParser<ParseHandler, Unit>::finishClassConstructor(
// Field initialization need access to `this`.
ctorbox->setHasThisBinding();
}
// Set the same information, but on the lazyScript.
if (ctorbox->hasFunction()) {
if (!ctorbox->emitBytecode) {
ctorbox->function()->baseScript()->setToStringEnd(classEndOffset);
if (numFields > 0) {
ctorbox->function()->baseScript()->setFunctionHasThisBinding();
}
} else {
// There should not be any non-lazy script yet.
MOZ_ASSERT(ctorbox->function()->isIncomplete());
}
}
}
return true;

Просмотреть файл

@ -492,12 +492,7 @@ class FunctionBox : public SharedContext {
bool needsPromiseResult() const { return isAsync() && !isGenerator(); }
bool isArrow() const { return flags_.isArrow(); }
bool isLambda() const {
if (hasFunction()) {
return function()->isLambda();
}
return functionCreationData().get().flags.isLambda();
}
bool isLambda() const { return flags_.isLambda(); }
void setDeclaredArguments() {
immutableFlags_.setFlag(ImmutableFlags::ShouldDeclareArguments);
@ -572,15 +567,11 @@ class FunctionBox : public SharedContext {
immutableFlags_.setFlag(ImmutableFlags::AlwaysNeedsArgsObj);
}
void setNeedsHomeObject() {
MOZ_ASSERT_IF(hasFunction(), function()->allowSuperProperty());
MOZ_ASSERT_IF(!hasFunction(),
functionCreationData().get().flags.allowSuperProperty());
MOZ_ASSERT(flags_.allowSuperProperty());
immutableFlags_.setFlag(ImmutableFlags::NeedsHomeObject);
}
void setDerivedClassConstructor() {
MOZ_ASSERT_IF(hasFunction(), function()->isClassConstructor());
MOZ_ASSERT_IF(!hasFunction(),
functionCreationData().get().flags.isClassConstructor());
MOZ_ASSERT(flags_.isClassConstructor());
immutableFlags_.setFlag(ImmutableFlags::IsDerivedClassConstructor);
}
void setFunctionHasExtraBodyVarScope() {