import { Joinpoint } from "@specs-feup/clava/api/Joinpoints.js"; import MISRARule from "../../MISRARule.js"; import { AnalysisType, MISRATransformationReport } from "../../MISRA.js"; /** * MISRA-C Rule 16.5: A default label shall appear as either the first or the last switch label of a switch statement */ export default class Rule_16_5_DefaultFirstOrLast extends MISRARule { /** * Scope of analysis */ readonly analysisType = AnalysisType.SINGLE_TRANSLATION_UNIT; /** * @returns Rule identifier according to MISRA-C:2012 */ get name(): string; /** * Retrieves all consecutive case statements to the left of a given case statement * * @param $jp - The starting case statement from which the search will begin * @returns Array containing consecutive case statements to the left of the provided joinpoint * */ private getConsecutiveRightCases; /** * Retrieves all consecutive case statements to the right of a given case statement * * @param $jp - The starting case statement from which the search will begin * @returns Array containing consecutive case statements to the right of the provided joinpoint * */ private getConsecutiveLeftCases; /** * Checks if the given joinpoint is a switch statement where the default label appears either as first of last label * @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 so that the default case appears as the last label * - If the default case is not already the last case within its case clause list, it is repositioned * - Then, the entire case clause list containing the default case to the end of the switch statement * @param $jp - Joinpoint to transform * @returns Report detailing the transformation result */ apply($jp: Joinpoint): MISRATransformationReport; } //# sourceMappingURL=Rule_16_5_DefaultFirstOrLast.d.ts.map