| 325 | |
| 326 | // src/tree_cursor.ts |
| 327 | var TreeCursor = class _TreeCursor { |
| 328 | static { |
| 329 | __name(this, "TreeCursor"); |
| 330 | } |
| 331 | /** @internal */ |
| 332 | // @ts-expect-error: never read |
| 333 | [0] = 0; |
| 334 | // Internal handle for Wasm |
| 335 | /** @internal */ |
| 336 | // @ts-expect-error: never read |
| 337 | [1] = 0; |
| 338 | // Internal handle for Wasm |
| 339 | /** @internal */ |
| 340 | // @ts-expect-error: never read |
| 341 | [2] = 0; |
| 342 | // Internal handle for Wasm |
| 343 | /** @internal */ |
| 344 | // @ts-expect-error: never read |
| 345 | [3] = 0; |
| 346 | // Internal handle for Wasm |
| 347 | /** @internal */ |
| 348 | tree; |
| 349 | /** @internal */ |
| 350 | constructor(internal, tree) { |
| 351 | assertInternal(internal); |
| 352 | this.tree = tree; |
| 353 | unmarshalTreeCursor(this); |
| 354 | } |
| 355 | /** Creates a deep copy of the tree cursor. This allocates new memory. */ |
| 356 | copy() { |
| 357 | const copy = new _TreeCursor(INTERNAL, this.tree); |
| 358 | C._ts_tree_cursor_copy_wasm(this.tree[0]); |
| 359 | unmarshalTreeCursor(copy); |
| 360 | return copy; |
| 361 | } |
| 362 | /** Delete the tree cursor, freeing its resources. */ |
| 363 | delete() { |
| 364 | marshalTreeCursor(this); |
| 365 | C._ts_tree_cursor_delete_wasm(this.tree[0]); |
| 366 | this[0] = this[1] = this[2] = 0; |
| 367 | } |
| 368 | /** Get the tree cursor's current {@link Node}. */ |
| 369 | get currentNode() { |
| 370 | marshalTreeCursor(this); |
| 371 | C._ts_tree_cursor_current_node_wasm(this.tree[0]); |
| 372 | return unmarshalNode(this.tree); |
| 373 | } |
| 374 | /** |
| 375 | * Get the numerical field id of this tree cursor's current node. |
| 376 | * |
| 377 | * See also {@link TreeCursor#currentFieldName}. |
| 378 | */ |
| 379 | get currentFieldId() { |
| 380 | marshalTreeCursor(this); |
| 381 | return C._ts_tree_cursor_current_field_id_wasm(this.tree[0]); |
| 382 | } |
| 383 | /** Get the field name of this tree cursor's current node. */ |
| 384 | get currentFieldName() { |