mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1163851 - Actually respect the InHandling parameter in the parser. |pc->parsingForInit| is now unused except for testing; it'll be removed once this has stuck a bit, as this change *does* change semantics in some edge cases. r=efaust
--HG-- extra : rebase_source : 6f145703264eb617f905d9cd4b5884b4430c47fa
This commit is contained in:
parent
81f2044adf
commit
4fa5c7ef6a
@ -6294,12 +6294,6 @@ BinaryOpParseNodeKindToJSOp(ParseNodeKind pnk)
|
||||
return ParseNodeKindToJSOp[pnk - PNK_BINOP_FIRST];
|
||||
}
|
||||
|
||||
static bool
|
||||
IsBinaryOpToken(TokenKind tok, bool parsingForInit)
|
||||
{
|
||||
return tok == TOK_IN ? !parsingForInit : TokenKindIsBinaryOp(tok);
|
||||
}
|
||||
|
||||
static ParseNodeKind
|
||||
BinaryOpTokenKindToParseNodeKind(TokenKind tok)
|
||||
{
|
||||
@ -6377,10 +6371,8 @@ Parser<ParseHandler>::orExpr1(InHandling inHandling, YieldHandling yieldHandling
|
||||
if (!tokenStream.getToken(&tok))
|
||||
return null();
|
||||
|
||||
// FIXME: Change this to use |inHandling == InAllowed|, not
|
||||
// |pc->parsingForInit|.
|
||||
ParseNodeKind pnk;
|
||||
if (IsBinaryOpToken(tok, oldParsingForInit)) {
|
||||
if (tok == TOK_IN ? inHandling == InAllowed : TokenKindIsBinaryOp(tok)) {
|
||||
pnk = BinaryOpTokenKindToParseNodeKind(tok);
|
||||
} else {
|
||||
tok = TOK_EOF;
|
||||
|
@ -0,0 +1,33 @@
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/licenses/publicdomain/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
var gTestfile = "arrow-function-in-for-statement-head.js";
|
||||
var BUGNUMBER = 1163851;
|
||||
var summary =
|
||||
"|for (x => 0 in 1;;) break;| must be a syntax error per ES6, not an " +
|
||||
"elaborate nop";
|
||||
|
||||
print(BUGNUMBER + ": " + summary);
|
||||
|
||||
/**************
|
||||
* BEGIN TEST *
|
||||
**************/
|
||||
|
||||
try
|
||||
{
|
||||
Function("for (x => 0 in 1;;) break;");
|
||||
throw new Error("didn't throw");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
assertEq(e instanceof SyntaxError, true,
|
||||
"expected syntax error, got " + e);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
|
||||
print("Tests complete");
|
Loading…
Reference in New Issue
Block a user