Yes, this is the expected behavior. Production rule instructionsif
if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return]
but the ad is let notStatement and therefore not allowed in this position:
Statement[Yield, Return] :
BlockStatement[?Yield, ?Return]
VariableStatement[?Yield]
EmptyStatement
ExpressionStatement[?Yield]
IfStatement[?Yield, ?Return]
BreakableStatement[?Yield, ?Return]
ContinueStatement[?Yield]
BreakStatement[?Yield]
[+Return] ReturnStatement[?Yield]
WithStatement[?Yield, ?Return]
LabelledStatement[?Yield, ?Return]
ThrowStatement[?Yield]
TryStatement[?Yield, ?Return]
DebuggerStatement
Declaration[Yield] :
HoistableDeclaration[?Yield]
ClassDeclaration[?Yield]
LexicalDeclaration[In, ?Yield]
LexicalDeclaration[In, Yield] :
LetOrConst BindingList[?In, ?Yield] ;
source
share