parseTry method
Implementation
Statement parseTry() {
int? start = token!.startOffset;
int? line = token!.line;
assert(token!.text == 'try');
consume(Token.NAME);
BlockStatement body = parseBlock();
CatchClause? handler;
BlockStatement? finalizer;
if (peekName('catch')) {
Token catchTok = next();
consume(Token.LPAREN);
Name name = parseName();
consume(Token.RPAREN);
BlockStatement catchBody = parseBlock();
handler = CatchClause(name, catchBody)
..start = catchTok.startOffset
..end = endOffset
..line = catchTok.line;
}
if (tryName('finally')) {
finalizer = parseBlock();
}
return TryStatement(body, handler, finalizer)
..start = start
..end = endOffset
..line = line;
}