查了下。 有这个定义。 { block }
12.1 Block
Syntax
Block :
{ StatementList[opt] }
StatementList :
--- Statement
--- StatementList Statement
Semantics
The production Block : { } is evaluated as follows:
1.
Return (normal, empty, empty).
The production Block : { StatementList }is evaluated as follows:
1.
Return the result of evaluating StatementList.
The production StatementList : Statement is evaluated as follows:
1.
Let s be the result of evaluating Statement.
2.
If an exception was thrown, return (throw, V, empty) where V is the exception. (Execution now proceeds as if no exception were thrown.)
3.
Return s.
The production StatementList : StatementList Statement is evaluated as follows:
1.
Let sl be the result of evaluating StatementList.
2.
If sl is an abrupt completion, return sl.
3.
Let s be the result of evaluating Statement.
4.
If an exception was thrown, return (throw, V, empty) where V is the exception. (Execution now proceeds as if no exception were thrown.)
5.
If s.value is empty, let V = sl.value, otherwise let V = s.value.
6.
Return (s.type, V, s.target).
当 {} 里为空的时候, 返回 normal, empty ,根据 15.1.2.1 第7条的描述 7.
If result.type is normal and its completion value is empty, then return the value undefined. 所以 eval("{}") 得到 undefined
当{} 里面不为空的时候, Let sl be the result of evaluating StatementList., 返回 sl的值,
12.1 Block
Syntax
Block :
{ StatementList[opt] }
StatementList :
--- Statement
--- StatementList Statement
Semantics
The production Block : { } is evaluated as follows:
1.
Return (normal, empty, empty).
The production Block : { StatementList }is evaluated as follows:
1.
Return the result of evaluating StatementList.
The production StatementList : Statement is evaluated as follows:
1.
Let s be the result of evaluating Statement.
2.
If an exception was thrown, return (throw, V, empty) where V is the exception. (Execution now proceeds as if no exception were thrown.)
3.
Return s.
The production StatementList : StatementList Statement is evaluated as follows:
1.
Let sl be the result of evaluating StatementList.
2.
If sl is an abrupt completion, return sl.
3.
Let s be the result of evaluating Statement.
4.
If an exception was thrown, return (throw, V, empty) where V is the exception. (Execution now proceeds as if no exception were thrown.)
5.
If s.value is empty, let V = sl.value, otherwise let V = s.value.
6.
Return (s.type, V, s.target).
当 {} 里为空的时候, 返回 normal, empty ,根据 15.1.2.1 第7条的描述 7.
If result.type is normal and its completion value is empty, then return the value undefined. 所以 eval("{}") 得到 undefined
当{} 里面不为空的时候, Let sl be the result of evaluating StatementList., 返回 sl的值,


