зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1574180 - Part 3: Remove special-case for inferred empty name string. r=khyperia
An absent name and an empty string as the inferred name are now indistinguishable, so we can remove the special case for empty strings in ObjectEmitter. Depends on D42154 Differential Revision: https://phabricator.services.mozilla.com/D42155 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5e05a4da7e
Коммит
2900da90f1
|
@ -685,15 +685,6 @@ bool ClassEmitter::emitInitDefaultConstructor(const Maybe<uint32_t>& classStart,
|
|||
}
|
||||
}
|
||||
|
||||
// The empty string is used as a placeholder, so if the inferred name for this
|
||||
// anonymous class expression is also the empty string, we need to set it
|
||||
// explicitly here.
|
||||
if (nameForAnonymousClass_ == bce_->cx->names().empty) {
|
||||
if (!emitSetEmptyClassConstructorNameForDefaultCtor()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!initProtoAndCtor()) {
|
||||
// [stack] CTOR HOMEOBJ
|
||||
return false;
|
||||
|
@ -705,22 +696,6 @@ bool ClassEmitter::emitInitDefaultConstructor(const Maybe<uint32_t>& classStart,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ClassEmitter::emitSetEmptyClassConstructorNameForDefaultCtor() {
|
||||
uint32_t nameIndex;
|
||||
if (!bce_->makeAtomIndex(bce_->cx->names().empty, &nameIndex)) {
|
||||
return false;
|
||||
}
|
||||
if (!bce_->emitIndexOp(JSOP_STRING, nameIndex)) {
|
||||
// [stack] CTOR NAME
|
||||
return false;
|
||||
}
|
||||
if (!bce_->emit2(JSOP_SETFUNNAME, uint8_t(FunctionPrefixKind::None))) {
|
||||
// [stack] CTOR
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ClassEmitter::initProtoAndCtor() {
|
||||
// [stack] NAME? HOMEOBJ CTOR
|
||||
|
||||
|
|
|
@ -776,7 +776,6 @@ class MOZ_STACK_CLASS ClassEmitter : public PropertyEmitter {
|
|||
MOZ_MUST_USE bool emitEnd(Kind kind);
|
||||
|
||||
private:
|
||||
MOZ_MUST_USE bool emitSetEmptyClassConstructorNameForDefaultCtor();
|
||||
MOZ_MUST_USE bool initProtoAndCtor();
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче