Let's say that at some point of a parsing process, I've already traversed the following grammar derivation:
Script -> ScriptBody -> StatementList -> ExpressionStatement -> Expression
Here comes the trouble. According to the spec, an Expression
within an ExpressionStatement
can only end up as an AssignmentExpression
or a sequence of those. However, statements like
a;
12;
"some text";
definitely are expression statements (as far as I understand), at the same time not being any of the AssignmentExpression
's possible subtypes. They do not resolve to a syntax error in my browsers.
Is it a particular implementation's or engine's feature that these statements return the value or am I missing something in the spec? Maybe, those are not AssignmentExpressions
at all and I'm mistaking them for something else?