Skip to content

Commit

Permalink
fixed files form Closure #27
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 55ca9ca commit b81cf5c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions projects/Closure/27/com/google/javascript/rhino/IR.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public static Node block(Node ... stmts) {
return block;
}

private static Node blockUnchecked(Node stmt) {
return new Node(Token.BLOCK, stmt);
}

public static Node script(Node ... stmts) {
// TODO(johnlenz): finish setting up the SCRIPT node
Expand Down Expand Up @@ -221,16 +224,16 @@ public static Node labelName(String name) {
}

public static Node tryFinally(Node tryBody, Node finallyBody) {
Preconditions.checkState(tryBody.isLabelName());
Preconditions.checkState(finallyBody.isLabelName());
Preconditions.checkState(tryBody.isBlock());
Preconditions.checkState(finallyBody.isBlock());
Node catchBody = block().copyInformationFrom(tryBody);
return new Node(Token.TRY, tryBody, catchBody, finallyBody);
}

public static Node tryCatch(Node tryBody, Node catchNode) {
Preconditions.checkState(tryBody.isBlock());
Preconditions.checkState(catchNode.isCatch());
Node catchBody = block(catchNode).copyInformationFrom(catchNode);
Node catchBody = blockUnchecked(catchNode).copyInformationFrom(catchNode);
return new Node(Token.TRY, tryBody, catchBody);
}

Expand Down

0 comments on commit b81cf5c

Please sign in to comment.