buildScope method
Rebuilds all dirty elements that are descendants of root.
Implementation
void buildScope(Element root) {
if (_dirty.isEmpty) return;
var safety = 0;
while (_dirty.isNotEmpty && safety < 1000) {
safety++;
final candidates = _dirty.where((e) => _isDescendantOf(e, root)).toList();
if (candidates.isEmpty) break;
candidates.sort((a, b) => a.depth.compareTo(b.depth));
final toBuild = <Element>[];
final dirtySet = _dirty.toSet();
for (final element in candidates) {
if (_hasDirtyAncestor(element, dirtySet)) continue;
toBuild.add(element);
}
if (toBuild.isEmpty) break;
for (final element in toBuild) {
if (!_dirty.remove(element)) continue;
_logBuild(element);
element.rebuild();
}
}
}