mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-08-16 14:40:23 +03:00
Avoid the cost of reading node.children
when we don't need to
This commit is contained in:
parent
5472e32e21
commit
5ea9adf13b
@ -4501,7 +4501,7 @@ class NodeRangeSet {
|
||||
getNodeSpec(node, getChildren) {
|
||||
let { startIndex, endIndex, startPosition, endPosition, id } = node;
|
||||
let result = { startIndex, endIndex, startPosition, endPosition, id };
|
||||
if (node.children && getChildren) {
|
||||
if (getChildren && node.childCount > 0) {
|
||||
result.children = [];
|
||||
for (let child of node.children) {
|
||||
result.children.push(this.getNodeSpec(child, false));
|
||||
|
Loading…
Reference in New Issue
Block a user