Skip to content

Commit e768962

Browse files
committed
non strict mode is not supported
1 parent 5333a54 commit e768962

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

YantraJS.Core/FastParser/Parser/FastParser.ForStatement.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,23 @@ bool ForStatement(out AstStatement node)
8686

8787
// we need to check if beginNode contains `in` expression
8888
// as `a in b` is a valid single expression
89-
if (beginNode is AstBinaryExpression b
89+
if (beginNode.Type == FastNodeType.BinaryExpression
90+
&& beginNode is AstBinaryExpression b
9091
&& b.Operator == TokenTypes.In
9192
&& stream.CheckAndConsume(TokenTypes.BracketEnd))
9293
{
9394
@in = true;
9495
beginNode = b.Left;
9596
inTarget = b.Right;
97+
98+
/** This is not working, and we may not support it **/
99+
// this is also special case in non strict mode
100+
// we will need to move variable in outer scope
101+
// if (beginNode.Type == FastNodeType.Identifier)
102+
// {
103+
// var id = (beginNode as AstIdentifier)!;
104+
// scope.AddVariable(id.Start, in id.Name, FastVariableKind.Var);
105+
// }
96106
}
97107
else
98108
{

0 commit comments

Comments
 (0)