DAS: refactor notification manager to not create local functions each time we check if a file is analyzed

Just a refactor to simplify code, and save local-function allocations
for each file.

Change-Id: Ic47212f493a44a2aec072ce999c4421e9960344e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508201
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins
2026-06-01 12:00:46 -07:00
committed by Samuel Rawlins
parent a651c3c539
commit 5c2007b086
@@ -352,31 +352,30 @@ abstract class AbstractNotificationManager {
_currentSubscriptions = newSubscriptions;
}
/// Return `true` if errors should be collected for the file with the given
/// Returns whether errors should be collected for the file with the given
/// [path] (because it is being analyzed).
bool _isIncluded(String path) {
bool isIncluded() {
for (var includedPath in _includedPaths) {
if (_pathContext.isWithin(includedPath, path) ||
_pathContext.equals(includedPath, path)) {
return true;
}
}
return false;
}
bool isExcluded() {
for (var excludedPath in _excludedPaths) {
if (_pathContext.isWithin(excludedPath, path)) {
return true;
}
}
return false;
}
// TODO(brianwilkerson): Return false if error notifications are globally
// disabled.
return isIncluded() && !isExcluded();
var isIncluded = false;
for (var includedPath in _includedPaths) {
if (_pathContext.isWithin(includedPath, path) ||
_pathContext.equals(includedPath, path)) {
isIncluded = true;
break;
}
}
if (!isIncluded) {
return false;
}
for (var excludedPath in _excludedPaths) {
if (_pathContext.isWithin(excludedPath, path)) {
return false;
}
}
return true;
}
/// Records a print notification from the analyzer plugin.