Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Mar 27, 2024
1 parent 65092c5 commit db15961
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ public void insertThrowOnTrue(Node booleanExpressionNode, TypeMirror errorType)
insertThrowOn(true, booleanExpressionNode, errorType);
}

/**
* Extend the CFG to throw an exception unconditionally.
*
* @param errorType the type of the exception to throw.
*/
public void insertUnconditionalThrow(TypeMirror errorType) {
// the value that gets thrown does not matter; we just throw 0
LiteralTree dummyValueToThrowTree = treeBuilder.buildLiteral(0);
handleArtificialTree(dummyValueToThrowTree);
Node dummyValueToThrowNode = new IntegerLiteralNode(dummyValueToThrowTree);
Expand All @@ -178,6 +184,14 @@ private void insertThrowOn(boolean throwOn, Node booleanExpressionNode, TypeMirr
this.addLabelForNextNode(endPrecondition);
}

/**
* Extend the CFG to throw an exception with the given type, using the given expression tree as
* the thrown expression.
*
* @param thrownExpressionNode node representing the expression to throw
* @param thrownExpressionTree tree representing the expression to throw
* @param errorType the type of the exception to throw
*/
private void insertThrow(
Node thrownExpressionNode, ExpressionTree thrownExpressionTree, TypeMirror errorType) {
ExtendedNode exNode =
Expand Down

0 comments on commit db15961

Please sign in to comment.