Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
follow the spec for try statement handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
hegemonic committed Oct 27, 2013
1 parent a6094c7 commit 1342322
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/org/jsdoc/AstBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -871,15 +871,15 @@ private void processTryStatement(TryStatement rhinoNode, Entry info)
CatchClause current;
AstNode finalizer = rhinoNode.getFinallyBlock();

List<AstNode> handlers = new ArrayList<AstNode>();
AstNode handler = null;
List<CatchClause> catchClauses = rhinoNode.getCatchClauses();
List<AstNode> guardedHandlers = new ArrayList<AstNode>();
Iterator<CatchClause> iterator = catchClauses.iterator();

while (iterator.hasNext()) {
current = iterator.next();
if (current.getIfPosition() == -1) {
handlers.add(current);
handler = current;
iterator.remove();
} else {
guardedHandlers.add(current);
Expand All @@ -889,8 +889,7 @@ private void processTryStatement(TryStatement rhinoNode, Entry info)
info.put(TYPE, JsDocNode.TRY_STATEMENT);

info.put("block", processNode(rhinoNode.getTryBlock()));
// Esprima uses an array, so we do too
info.put("handlers", processNodeList(handlers));
info.put("handler", handler == null ? handler : processNode(handler));
info.put("guardedHandlers", processNodeList(guardedHandlers));
info.put("finalizer", finalizer == null ? finalizer : processNode(finalizer));
}
Expand Down

0 comments on commit 1342322

Please sign in to comment.