Improve function declaration detection

Handles blank lines between function arguments gracefully.
Fix bug where detects `switch` statements as function declarations.