Merge pull request #2466 from tom95/add-field-name-for-child
Web Bindings: Expose fieldNameForChild C function
This commit is contained in:
commit
7d953eb5ba
4 changed files with 33 additions and 0 deletions
|
|
@ -282,6 +282,17 @@ class Node {
|
|||
return unmarshalNode(this.tree);
|
||||
}
|
||||
|
||||
fieldNameForChild(index) {
|
||||
marshalNode(this);
|
||||
const address = C._ts_node_field_name_for_child_wasm(this.tree[0], index);
|
||||
if (!address) {
|
||||
return null;
|
||||
}
|
||||
const result = AsciiToString(address);
|
||||
// must not free, the string memory is owned by the language
|
||||
return result;
|
||||
}
|
||||
|
||||
namedChild(index) {
|
||||
marshalNode(this);
|
||||
C._ts_node_named_child_wasm(this.tree[0], index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue