Class SanitizedInVariableDeclarationOrError

java.lang.Object
org.ek9lang.compiler.phase2.SanitizedInVariableDeclarationOrError
All Implemented Interfaces:
Consumer<EK9Parser.VariableDeclarationContext>

final class SanitizedInVariableDeclarationOrError extends Object implements Consumer<EK9Parser.VariableDeclarationContext>
Checks for inappropriate use of 'sanitized' in variable declarations. This checker rejects 'sanitized' in variable declarations, as the keyword only belongs on function/method parameter definitions (entry points).

The "Rejection at the Source" philosophy means sanitization is a boundary concern specified at function/method parameter definitions, not at: - Variable declarations with initialization - Assignment expressions

Grammar rules this checks:

variableDeclaration
    : identifier AS? SANITIZED? typeDef QUESTION? op=(ASSIGN|...) assignmentExpression
    | identifier op=LEFT_ARROW SANITIZED? assignmentExpression
    ;