CommentDirectiveParser class
Generic token-based suppression parser for // <tool>:ignore and
// <tool>:ignore_for_file comment suppression directives.
Because this parser inspects token stream comments rather than raw string matching, it is completely immune to false positives inside string literals.
Constructors
- CommentDirectiveParser(String toolName)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- ignoreDeclarationPattern → RegExp
-
final
- ignoreForFilePattern → RegExp
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toolName → String
-
final
Methods
-
hasIgnoreForFile(
CompilationUnit unit, [String? sourceCode]) → bool -
Returns
trueifunitcontains a file-level suppression directive (// <tool>:ignore_for_file) in its comments. -
isDeclarationIgnored(
AstNode node) → bool -
Returns
trueifnodeis preceded by a// <tool>:ignoredirective. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
hasIgnoreForFileDirective(
CompilationUnit unit, {required String toolName, String? sourceCode}) → bool -
Static helper to check file-level suppression for a given
toolName. -
isDeclarationIgnoredFor(
AstNode node, {required String toolName}) → bool -
Static helper to check declaration-level suppression for a given
toolName.