#343·json5

question: commented unreachable code

Author: mqncCreated Feb 10, 2024Updated Feb 21, 2024
Labelsquestion :question:

The parser code contains lots of these comments:

javascript
    // This code is unreachable.
    // default:
    //     throw invalidToken()

It looks like there was this code before but it was taken out by some sort of reachability analysis. Is there some tool for this which proves the unreachability of certain code parts or did you sit down with pen and paper and think really hard?