Don't enforce [k,v] pattern restriction if destructuring for-each (346642).

This commit is contained in:
brendan%mozilla.org 2006-09-30 23:53:20 +00:00
parent f336401660
commit 19c7d67134

View File

@ -2804,18 +2804,20 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
if (TOKEN_TYPE_IS_DECL(tt)
? (pn1->pn_count > 1 || pn1->pn_op == JSOP_DEFCONST
#if JS_HAS_DESTRUCTURING
|| pn1->pn_head->pn_type == TOK_RC
|| (pn1->pn_head->pn_type == TOK_RB &&
pn1->pn_head->pn_count != 2)
|| (pn1->pn_head->pn_type == TOK_ASSIGN &&
(pn1->pn_head->pn_left->pn_type != TOK_RB ||
pn1->pn_head->pn_left->pn_count != 2))
|| (pn->pn_op == JSOP_FORIN &&
(pn1->pn_head->pn_type == TOK_RC ||
(pn1->pn_head->pn_type == TOK_RB &&
pn1->pn_head->pn_count != 2) ||
(pn1->pn_head->pn_type == TOK_ASSIGN &&
(pn1->pn_head->pn_left->pn_type != TOK_RB ||
pn1->pn_head->pn_left->pn_count != 2))))
#endif
)
: (pn1->pn_type != TOK_NAME &&
pn1->pn_type != TOK_DOT &&
#if JS_HAS_DESTRUCTURING
(pn1->pn_type != TOK_RB || pn1->pn_count != 2) &&
(pn->pn_op == JSOP_FORIN &&
(pn1->pn_type != TOK_RB || pn1->pn_count != 2)) &&
#endif
#if JS_HAS_LVALUE_RETURN
pn1->pn_type != TOK_LP &&