8.9 Completion type

2010-04-19

The Completion type is used to explain the behavior of return, break, continue and throw. These are the only statements that perform "nonlogical transfers of control". Meaning they can jump to any other point in the code, with or without explicitly defining that point.

The type is a triple: Completion(type, value, target). Type is one of normal, break, continue, return, throw. Value can be of any type. Target is an Identifier or empty.

"abrubt completion" refers to any other type than normal.

In the Meta Ecma language, the following is declared:

Code: (Meta Ecma)
function Completion(type, value, target) {
return {
type: type,
value: value,
target: target,
isAbrubt: function(){
return type != 'normal';
}
};
}

So any call to Completion(x,y,z) returns an object literal with three properties and one method.