Skip to content

Commit 83857a4

Browse files
committed
OS#17790507: [Test262] Throw SyntaxError rather than early ReferenceError on bad LHS in for loop header
1 parent c198502 commit 83857a4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/Parser/Parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9918,7 +9918,7 @@ ParseNodePtr Parser::ParseStatement()
99189918
? !PHASE_OFF_RAW(Js::EarlyReferenceErrorsPhase, m_sourceContextInfo->sourceContextId, GetCurrentFunctionNode()->functionId)
99199919
: !PHASE_OFF1(Js::EarlyReferenceErrorsPhase)))
99209920
{
9921-
Error(JSERR_CantAssignTo);
9921+
Error(ERRInvalidLHSInFor);
99229922
}
99239923

99249924
this->GetScanner()->Scan();

lib/Parser/perrors.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,5 @@ LSC_ERROR_MSG(1086, ERRInvalidModuleImportOrExport, "Module import or export sta
100100
LSC_ERROR_MSG(1087, ERRInvalidExportName, "Unable to resolve module export name")
101101

102102
LSC_ERROR_MSG(1088, ERRLetIDInLexicalDecl, "'let' is not an allowed identifier in lexical declarations")
103+
104+
LSC_ERROR_MSG(1089, ERRInvalidLHSInFor, "Invalid left-hand side in for loop")

0 commit comments

Comments
 (0)