fix(lib): account for the root node of a tree cursor being an alias

This commit is contained in:
Amaan Qureshi 2024-03-18 07:51:32 -04:00
parent 24a68697ac
commit 09d2b23a64
7 changed files with 16 additions and 8 deletions

View file

@ -6,7 +6,7 @@
const C = Module;
const INTERNAL = {};
const SIZE_OF_INT = 4;
const SIZE_OF_CURSOR = 3 * SIZE_OF_INT;
const SIZE_OF_CURSOR = 4 * SIZE_OF_INT;
const SIZE_OF_NODE = 5 * SIZE_OF_INT;
const SIZE_OF_POINT = 2 * SIZE_OF_INT;
const SIZE_OF_RANGE = 2 * SIZE_OF_INT + 2 * SIZE_OF_POINT;
@ -1493,12 +1493,14 @@ function marshalTreeCursor(cursor, address = TRANSFER_BUFFER) {
setValue(address + 0 * SIZE_OF_INT, cursor[0], 'i32'),
setValue(address + 1 * SIZE_OF_INT, cursor[1], 'i32'),
setValue(address + 2 * SIZE_OF_INT, cursor[2], 'i32');
setValue(address + 3 * SIZE_OF_INT, cursor[3], 'i32');
}
function unmarshalTreeCursor(cursor) {
cursor[0] = getValue(TRANSFER_BUFFER + 0 * SIZE_OF_INT, 'i32'),
cursor[1] = getValue(TRANSFER_BUFFER + 1 * SIZE_OF_INT, 'i32'),
cursor[2] = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, 'i32');
cursor[3] = getValue(TRANSFER_BUFFER + 3 * SIZE_OF_INT, 'i32');
}
function marshalPoint(address, point) {