12.1 Block

2010-05-23

Block :
{ StatementList(opt) }

StatementList :
Statement
StatementList Statement

See also Completion (8.9).

Code: (Meta Ecma)
function evaluate({ }){
return Completion('normal', undefined, undefined);
}


Code: (Meta Ecma)
function evaluate({ StatementList }){
return evaluate(StatementList;
}


Code: (Meta Ecma)
function evaluate(Statement){
try {
var s = evaluate(Statement);
} catch (E) {
return Completion('throw', E, undefined);
}
return s;
}


Code: (Meta Ecma)
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.