diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 3e3c99ceaa10..4587f9f5ee56 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -4414,20 +4414,6 @@ Parser::checkDestructuringAssignmentArray(ParseNode* * In the first case, other code parses the pattern as an arbitrary * primaryExpr, and then, here in checkDestructuringAssignmentPattern, verify * that the tree is a valid AssignmentPattern. - * - * In assignment-like contexts, we parse the pattern with - * pc->inDestructuringDecl clear, so the lvalue expressions in the pattern are - * parsed normally. identifierReference() links variable references into the - * appropriate use chains; creates placeholder definitions; and so on. - * checkDestructuringAssignmentPattern won't bind any new names and we - * specialize lvalues as appropriate. - * - * In declaration-like contexts, the normal variable reference processing - * would just be an obstruction, because we're going to define the names that - * appear in the property value positions as new variables anyway. In this - * case, we parse the pattern in destructuringDeclaration() with - * pc->inDestructuringDecl set, which directs identifierReference() to leave - * whatever name nodes it creates unconnected. */ template <> bool @@ -4450,39 +4436,19 @@ Parser::checkDestructuringAssignmentPattern(ParseNod return isDestructuring; } -class AutoClearInDestructuringDecl -{ - ParseContext* pc_; - Maybe saved_; - - public: - explicit AutoClearInDestructuringDecl(ParseContext* pc) - : pc_(pc), - saved_(pc->inDestructuringDecl) - { - pc->inDestructuringDecl = Nothing(); - if (saved_ && *saved_ == DeclarationKind::FormalParameter) - pc->functionBox()->hasParameterExprs = true; - } - - ~AutoClearInDestructuringDecl() { - pc_->inDestructuringDecl = saved_; - } -}; - template