slackhq / tree-sitter-hack

Hack grammar for tree-sitter
MIT License
33 stars 16 forks source link

Separate catch and finally clause types #22

Closed frankeld closed 3 years ago

frankeld commented 3 years ago

Summary

Previously, this rule incorrectly captured more than is allowed. Normally, this isn't a big issue. However, this causes problems downstream because we cannot directly interpret if clauses are catch or finally, and the old version falsely makes it seem like we can have a series of catch and finally clauses.

This version allows:

~⚠️ Merge blocked until verification of impact downstream~ No downstream issues

Requirements (place an x in each [ ])

Nicholas-Lin commented 3 years ago

Just curious are there any tests we can add that would have failed with the old grammar but now should pass. Perhaps something like try, catch, catch, finally or try, finally?

frankeld commented 3 years ago

@Nicholas-Lin Not really. The new grammar is strictly more strict, so anything in the new one will pass in the old one. However, I did add a test for multi-clause stuff because it wasn't actually covered.