wasm: Implement Node.descendantsOfType
This commit is contained in:
parent
1733180d48
commit
f00b310908
5 changed files with 151 additions and 4 deletions
|
|
@ -279,7 +279,7 @@ describe("Node", () => {
|
|||
);
|
||||
});
|
||||
|
||||
describe.skip('.descendantsOfType(type, min, max)', () => {
|
||||
describe('.descendantsOfType(type, min, max)', () => {
|
||||
it('finds all of the descendants of the given type in the given range', () => {
|
||||
tree = parser.parse("a + 1 * b * 2 + c + 3");
|
||||
const outerSum = tree.rootNode.firstChild.firstChild;
|
||||
|
|
@ -288,6 +288,10 @@ describe("Node", () => {
|
|||
descendants.map(node => node.startIndex),
|
||||
[4, 12]
|
||||
);
|
||||
assert.deepEqual(
|
||||
descendants.map(node => node.endPosition),
|
||||
[{row: 0, column: 5}, {row: 0, column: 13}]
|
||||
);
|
||||
|
||||
descendants = outerSum.descendantsOfType('identifier', {row: 0, column: 2}, {row: 0, column: 15})
|
||||
assert.deepEqual(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue