基于官方ECMA-262 edition 5.1 June 2011 standard:
The grammar summary defines that a grouping operator(parentheses) may only contain an expression:
PrimaryExpression :
this
Identifier
Literal
ArrayLiteral
ObjectLiteral
( Expression )
表达式只能是Assignmentexpression(或其序列)(滚动到section A.3的末尾)
Expression :
AssignmentExpression
Expression , AssignmentExpression
因此,根据ECMA-262版本5.1,以下内容应该是错误的:(FunctionExpression)
。
答案 0 :(得分:2)
经过一番挖掘,我发现它实际上是有效的。以下是完整的推导(将其追溯到section A.3的末尾,并从Expression
开始向上推导:
Expression -> AssignmentExpression -> ConditionalExpression ->
LogicalORExpression -> LogicalANDExpression ->
BitwiseORExpression -> BitwiseXORExpression ->
BitwiseANDExpression -> EqualityExpression ->
RelationalExpression -> ShiftExpression -> AdditiveExpression ->
MultiplicativeExpression -> UnaryExpression ->
PostfixExpression -> LeftHandSideExpression -> NewExpression ->
MemberExpression -> FunctionExpression