Skip to content

Commit

Permalink
Allow nulls in calls to Node#insert.
Browse files Browse the repository at this point in the history
  • Loading branch information
chumer committed Dec 1, 2017
1 parent 0d056d7 commit 06a4cc3
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ public SourceSection getEncapsulatingSourceSection() {
*/
protected final <T extends Node> T[] insert(final T[] newChildren) {
CompilerDirectives.transferToInterpreterAndInvalidate();
assert newChildren != null;
for (Node newChild : newChildren) {
adoptHelper(newChild);
if (newChildren != null) {
for (Node newChild : newChildren) {
adoptHelper(newChild);
}
}
return newChildren;
}
Expand All @@ -191,8 +192,9 @@ protected final <T extends Node> T[] insert(final T[] newChildren) {
*/
protected final <T extends Node> T insert(final T newChild) {
CompilerDirectives.transferToInterpreterAndInvalidate();
assert newChild != null;
adoptHelper(newChild);
if (newChild != null) {
adoptHelper(newChild);
}
return newChild;
}

Expand Down

0 comments on commit 06a4cc3

Please sign in to comment.