js-confuser
                                
                                 js-confuser copied to clipboard
                                
                                    js-confuser copied to clipboard
                            
                            
                            
                        Control Flow Flattening breaks function declaration in non-executed switch case block
Config and Small code sample
Config:
{
  target: "node",
  controlFlowFlattening: true
}
Code:
switch (true) {
  case false:
    function myFunction() { // This block is never ran, but declaration is still able to be called
      console.log("Hello World!");
    }
    break;
  case true:
    myFunction();
    break;
}
var filler1;
var filler2;
// "Hello World"
Expected behavior
The program should output "Hello World"
Actual behavior
TypeError: (intermediate value)(intermediate value) is not a function