Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Clean up inline directive parsing (#12375)
* Give variable name to matched text This simply makes the code a bit easier to read by giving a name to `match[1]`. * Refactor: Untangle logic for parsing directives There are a few thing going on in this function which were getting conflated: 1. Parsing a `directiveType` out of the comment. 2. Ignoring directives that are in line comments but only support block comments. 3. Warning on and ignoring line comments that span multiple lines. Previously these three pieces of functionality were tightly coupled which made the code harder to read. After this change each task is handled independently of the other. * Core: Consolidate handling disable directives Rather than conditionally set a mutable value and check for it at the end of the switch statement, we can actually just handle it inline by using a fallthrough.
- Loading branch information
1 parent
84467c0
commit 7ffb22f
Showing
1 changed file
with
87 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters