fix(wasm): restore passing in ERROR to descendantsOfType (#4226)

(cherry picked from commit 3b67861def)
This commit is contained in:
Will Lillis 2025-02-19 17:47:10 -05:00 committed by Christian Clason
parent 8b5c63bffa
commit 637a3e111b
2 changed files with 24 additions and 1 deletions

View file

@ -416,6 +416,11 @@ export class Node {
// Convert the type strings to numeric type symbols
const symbols: number[] = [];
const typesBySymbol = this.tree.language.types;
for (const node_type of types) {
if (node_type == "ERROR") {
symbols.push(65535); // Internally, ts_builtin_sym_error is -1, which is UINT_16MAX
}
}
for (let i = 0, n = typesBySymbol.length; i < n; i++) {
if (types.includes(typesBySymbol[i])) {
symbols.push(i);