parent
e710a14244
commit
41e9af2456
2 changed files with 32 additions and 4 deletions
|
|
@ -967,12 +967,13 @@ class Query {
|
|||
endPosition.column
|
||||
);
|
||||
|
||||
const count = getValue(TRANSFER_BUFFER, 'i32');
|
||||
const rawCount = getValue(TRANSFER_BUFFER, 'i32');
|
||||
const startAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32');
|
||||
const result = new Array(count);
|
||||
const result = new Array(rawCount);
|
||||
|
||||
let filteredCount = 0;
|
||||
let address = startAddress;
|
||||
for (let i = 0; i < count; i++) {
|
||||
for (let i = 0; i < rawCount; i++) {
|
||||
const pattern = getValue(address, 'i32');
|
||||
address += SIZE_OF_INT;
|
||||
const captureCount = getValue(address, 'i32');
|
||||
|
|
@ -981,7 +982,7 @@ class Query {
|
|||
const captures = new Array(captureCount);
|
||||
address = unmarshalCaptures(this, node.tree, address, captures);
|
||||
if (this.textPredicates[pattern].every(p => p(captures))) {
|
||||
result[i] = {pattern, captures};
|
||||
result[filteredCount++] = {pattern, captures};
|
||||
const setProperties = this.setProperties[pattern];
|
||||
if (setProperties) result[i].setProperties = setProperties;
|
||||
const assertedProperties = this.assertedProperties[pattern];
|
||||
|
|
@ -990,6 +991,7 @@ class Query {
|
|||
if (refutedProperties) result[i].refutedProperties = refutedProperties;
|
||||
}
|
||||
}
|
||||
result.length = filteredCount;
|
||||
|
||||
C._free(startAddress);
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue