Skip to content

Small code cleanup in Tool.java #2756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

StochasticTinkr
Copy link
Contributor

Summary of PR

  • Replace unnecessary generic arguments.
  • Simplify sortGrammarByTokenVocab: parseGrammar returns GrammarRootAST, so it can never return a GrammarASTErrorNode
  • Fix typo "no defined" -> "not defined"
  • Remove if branches that are provably unreachable in getOutputDirectory: (fileDirectory is either "." or a prefix of fileNameWithPath)

Contributor's Note

I'm creating this pull request mostly to see how open the maintainers are to this type of contribution. I see a lot of bits of this code that could be changed to reduce the cognitive load of the reader, and would like to help improve the code in that way.

If this kind of contribution is unwanted, please let me know and I will not create any more of this type.

Replace unnecessary generic arguments.
Simplify sortGrammarByTokenVocab: parseGrammar returns GrammarRootAST, so it can never return GrammarASTErrorNode
Fix typo "no defined" -> "not defined"
Remove if branches that are provably unreachable in getOutputDirectory: (fileDirectory is either "." or a prefix of fileNameWithPath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant