binding_web: Add Query.didExceedMatchLimit
This lets wasm clients check whether a query exceeded its maximum number of in-progress matches.
This commit is contained in:
parent
b5ec720696
commit
e8eb3c5d5a
4 changed files with 32 additions and 0 deletions
|
|
@ -238,6 +238,26 @@ describe("Query", () => {
|
|||
refutedProperties: { bar: "baz" },
|
||||
},
|
||||
]);
|
||||
assert.ok(!query.didExceedMatchLimit());
|
||||
});
|
||||
|
||||
it("detects queries with too many permutations to track", () => {
|
||||
tree = parser.parse(`
|
||||
[
|
||||
hello, hello, hello, hello, hello, hello, hello, hello, hello, hello,
|
||||
hello, hello, hello, hello, hello, hello, hello, hello, hello, hello,
|
||||
hello, hello, hello, hello, hello, hello, hello, hello, hello, hello,
|
||||
hello, hello, hello, hello, hello, hello, hello, hello, hello, hello,
|
||||
hello, hello, hello, hello, hello, hello, hello, hello, hello, hello,
|
||||
];
|
||||
`);
|
||||
|
||||
query = JavaScript.query(`
|
||||
(array (identifier) @pre (identifier) @post)
|
||||
`);
|
||||
|
||||
const captures = query.captures(tree.rootNode);
|
||||
assert.ok(query.didExceedMatchLimit());
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue