import { Joinpoint, Switch } from "@specs-feup/clava/api/Joinpoints.js"; import MISRARule from "../../MISRARule.js"; import { AnalysisType, MISRATransformationReport } from "../../MISRA.js"; /** * MISRA-C Rule 16.7: A switch-expression shall not have essentially Boolean type. */ export default class Rule_16_7_NonBooleanSwitchCondition extends MISRARule { /** * A positive integer starting from 1 that indicates the rule's priority, determining the order in which rules are applied. */ readonly priority = 5; /** * Scope of analysis */ readonly analysisType = AnalysisType.SINGLE_TRANSLATION_UNIT; /** * @returns Rule identifier according to MISRA-C:2012 */ get name(): string; /** * Checks if the provided switch statement has a Boolean condition * @param switchStmt The switch statement to check * @returns Returns true if the switch statement has a Boolean condition, otherwise false */ switchHasBooleanCondition(switchStmt: Switch): boolean; /** * Checks if the given joinpoint is a switch statement with an essentially Boolean condition * @param $jp - Joinpoint to analyze * @param logErrors - [logErrors=false] - Whether to log errors if a violation is detected * @returns Returns true if the joinpoint violates the rule, false otherwise */ match($jp: Joinpoint, logErrors?: boolean): boolean; /** * Transforms a switch statement with a Boolean condition into equivalent statement(s), only if there is no conditional break. * If a conditional break is present, no transformation is performed and an error is generated. * * @param $jp - Joinpoint to transform * @returns Report detailing the transformation result */ apply($jp: Joinpoint): MISRATransformationReport; } //# sourceMappingURL=Rule_16_7_NonBooleanSwitchCondition.d.ts.map