Skip to content

Commit

Permalink
Support isNull arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jun 3, 2024
1 parent a008b3d commit a6248a1
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,17 @@ Object execute(Object[] args, @CachedLibrary(limit = "3") InteropLibrary iop)
for (long i = 0; i < len; i++) {
var elem0 = iop.readArrayElement(arr0, i);
var elem1 = iop.readArrayElement(arr1, i);
var l0 = iop.asLong(elem0);
var l1 = iop.asLong(elem1);
iop.invokeMember(builder, "append", l0 + l1);
Object res;
if (iop.isNull(elem0)) {
res = elem1;
} else if (iop.isNull(elem1)) {
res = elem0;
} else {
var l0 = iop.asLong(elem0);
var l1 = iop.asLong(elem1);
res = l0 + l1;
}
iop.invokeMember(builder, "append", res);
}
return iop.invokeMember(builder, "build");
} catch (InvalidArrayIndexException | UnknownIdentifierException ex) {
Expand Down

0 comments on commit a6248a1

Please sign in to comment.