Skip to content

Commit

Permalink
Merge pull request #109 from rotu/patch-1
Browse files Browse the repository at this point in the history
Insert sanity check in marshalNode
  • Loading branch information
verhovsky authored Jul 17, 2023
2 parents 0bee0f9 + 57f723a commit 30b26fd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ function unmarshalNodes(nodes, tree) {
}

function marshalNode(node) {
if (!(node.tree instanceof Tree)){
throw new TypeError("SyntaxNode must belong to a Tree")
}
const {nodeTransferArray} = binding;
for (let i = 0; i < NODE_FIELD_COUNT; i++) {
nodeTransferArray[i] = node[i];
Expand Down

0 comments on commit 30b26fd

Please sign in to comment.