Skip to content

Dead pendingExit flag in isInTryCatchBlock #12

@CodeDeficient

Description

@CodeDeficient

What

The pendingExit flag at ai-slop-detector.ts:923 is set to true when a nested block inside a catch block closes, then unconditionally cleared to false on the very next line before any logic checks it:

if (pendingExit) {
    pendingExit = false;
}

The actual catch-block exit is driven by braceDepth <= catchBlockDepth, not pendingExit. The flag is set in two places (lines 944, 976) and cleared in four places (lines 949, 955-956, 987, 995) but never read elsewhere and has no effect on the outcome.

Impact

Dead code. No behavioral change on removal.

Fix

Either wire pendingExit into the exit logic as originally intended, or remove it entirely.

Location

ai-slop-detector.ts:923-995

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions