Skip to content

Commit 8c25e6d

Browse files
lauraharkercopybara-github
authored andcommitted
Simplify some Node API usages in ProductionCoverageInstrumentationCallback
PiperOrigin-RevId: 326162422
1 parent 5782405 commit 8c25e6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/com/google/javascript/jscomp/ProductionCoverageInstrumentationCallback.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void visit(NodeTraversal traversal, Node node, Node parent) {
138138
// Since we also make sure an Else case is added to every If statement, we are still
139139
// assured that the else statement is being reached through a later instrumentation call.
140140
if (NodeUtil.isEmptyBlock(ifFalseNode)
141-
|| (ifFalseNode.getFirstChild() != null && !ifFalseNode.getFirstChild().isIf())) {
141+
|| (ifFalseNode.hasChildren() && !ifFalseNode.getFirstChild().isIf())) {
142142
instrumentBlockNode(ifFalseNode, sourceFileName, functionName, Type.BRANCH_DEFAULT);
143143
}
144144
break;
@@ -206,7 +206,7 @@ private void addInstrumentationNodeWithComma(
206206

207207
// newInstrumentationNode returns an EXPR_RESULT which cannot be a child of a COMMA node.
208208
// Instead we use the child of of the newInstrumentatioNode which is a CALL node.
209-
Node childOfInstrumentationNode = newInstrumentationNode.getFirstChild().detach();
209+
Node childOfInstrumentationNode = newInstrumentationNode.removeFirstChild();
210210
Node infusedExp = AstManipulations.fuseExpressions(childOfInstrumentationNode, cloneOfOriginal);
211211
parentNode.replaceChild(originalNode, infusedExp);
212212
}

0 commit comments

Comments
 (0)