Block :
{ StatementList(opt) }
StatementList :
Statement
StatementList Statement
See also Completion (8.9).
function evaluate({ }){
return Completion('normal', undefined, undefined);
}
function evaluate({ StatementList }){
return evaluate(StatementList;
}
function evaluate(Statement){
try {
var s = evaluate(Statement);
} catch (E) {
return Completion('throw', E, undefined);
}
return s;
}
function evaluate(StatementList Statement){
var sl = evaluate(StatementList);
if (sl.isAbrubt()) return sl;
try {
var s = evaluate(Statement);
} catch (E) {
return Completion('throw', E, undefined);
}
if (s.value == 'empty') var V = sl.value;
else var V = s.value;
return Completion(s.type, V, s.target);
}
This last algorithm seems to be a possible source of confusion, as the returned V in the last return Statement might not be the last Statement of the StatementList... Needs investigation.