diff --git a/pkg/analysis_server/lib/src/plugin/notification_manager.dart b/pkg/analysis_server/lib/src/plugin/notification_manager.dart index de13837690f..26e94c8d239 100644 --- a/pkg/analysis_server/lib/src/plugin/notification_manager.dart +++ b/pkg/analysis_server/lib/src/plugin/notification_manager.dart @@ -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.