Whitecoin-XWC / xwc-gjavac

Java and Kotlin compiler for uvm
MIT License
0 stars 0 forks source link

For UvmArray.set(), when setting null to the last element, all null values at the end should be removed as well #8

Open tobiasholt opened 2 years ago

tobiasholt commented 2 years ago

In order to be compatible with LUA, setting the last element to nil will remove all the nil elements at the end of the array. image

As shown in the LUA code in the picture, originally there are 3 elements in the array, and we set the second one as nil first, the size of the array is still 3, but when we set the third one to nil, which is the last element in the array, the size becomes 1, which indicates the second and the third elements are both removed since they are both nil.

But in our gjavac code, only the last null element is handled: image

It needs to be fixed so that our Java smart contract will execute the same as those contracts in LUA.