Convert the trailing array of BindingNames at the end of the various kinds of scope data into raw unsigned chars into which those BindingNames are placement-new'd, rather than memcpy-ing non-trivial classes around and failing to comply with the C++ object model

This commit is contained in:
trav90 2018-09-02 18:45:56 -05:00 • committed by Roy Tam
commit 4cbf54089a
6 changed files with 108 additions and 64 deletions

View file

@ -319,7 +319,7 @@ ScopeKindIsInBody(ScopeKind kind)
static inline void
MarkAllBindingsClosedOver(LexicalScope::Data& data)
{
BindingName* names = data.names;
TrailingNamesArray& names = data.trailingNames;
for (uint32_t i = 0; i < data.length; i++)
names[i] = BindingName(names[i].name(), true);
}
@ -8978,7 +8978,8 @@ BytecodeEmitter::isRestParameter(ParseNode* pn, bool* result)
if (bindings->nonPositionalFormalStart > 0) {
// |paramName| can be nullptr when the rest destructuring syntax is
// used: `function f(...[]) {}`.
JSAtom* paramName = bindings->names[bindings->nonPositionalFormalStart - 1].name();
JSAtom* paramName =
bindings->trailingNames[bindings->nonPositionalFormalStart - 1].name();
*result = paramName && name == paramName;
return true;
}