Skip to content

Commit d57bf66

Browse files
author
Kevin Smith
committed
[MERGE #6286 @zenparsing] [test262] Allow "in" in the middle operand of ternaries
Merge pull request #6286 from zenparsing:test262-ternary-in https://github.com/tc39/test262/blob/master/test/language/expressions/conditional/in-branch-1.js
2 parents 28d68d2 + 5e952e3 commit d57bf66

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Parser/Parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9225,7 +9225,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
92259225
// Special case the "?:" operator
92269226
if (nop == knopQmark)
92279227
{
9228-
pnodeT = ParseExpr<buildAST>(koplAsg, NULL, fAllowIn);
9228+
pnodeT = ParseExpr<buildAST>(koplAsg, NULL, TRUE);
92299229
ChkCurTok(tkColon, ERRnoColon);
92309230
ParseNodePtr pnodeT2 = ParseExpr<buildAST>(koplAsg, NULL, fAllowIn, 0, nullptr, nullptr, nullptr, nullptr, false, nullptr, plastRParen);
92319231
if (buildAST)

test/Basics/TernaryOperator.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ WScript.Echo(cond ? "True" : "False");
1010
WScript.Echo("Setting condition to false...");
1111
cond = false;
1212
WScript.Echo(cond ? "True" : "False");
13+
14+
try {
15+
for (1 ? 'x' in {} : 0;;) break;
16+
} catch {
17+
WScript.Echo("In expression should be allowed in true part");
18+
}

0 commit comments

Comments
 (0)