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

This commit is contained in:
Will Lillis 2025-02-19 17:47:10 -05:00 committed by GitHub
parent b26b7f8d62
commit 3b67861def
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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);