ECMAScript describes an internal type for explaining the behavior of statements, which is called the Type of Completion Specification .
Values of the completion type are triples of the form (type, value, target), where:
typeIt can be normal, break, continue, returnor throw.valuecan be any language value or empty.targetmay be any Identifieror empty.
VariableStatement , , .
, , , , Block, Empty Statement, ExpressionStatement, debugger statement ( ) ..
A FunctionDeclaration ( , SourceElement) (normal, empty, empty), , :
eval("function f(){}");
eval function , normal, empty, undefined (. 7 eval), :
eval("(function f(){})");
PrimaryExpression, ExpressionStatement, (normal, GetValue(exprRef), empty), expRef FunctionExpression.
type, normal, " ".
:
function foo() {
return 5;
}
foo();
return foo , (return, 4, empty).
target break continue, LabelledStatement, :
foo: while(true) {
while(true) {
break foo;
}
}
break (break, empty, foo), while , foo.
, , , break, continue, return throw.