Whole file
terryyin/lizard
The author described this change as “fix: handle function stack correctly when starting a new function in TypeScript parser”. It counts as a record because the check below fails on the code as it stood at a1d1cac68 and passes on 147b1637f, with nothing else changed between the two runs.
Projectterryyin/lizard
Fix saved2026-05-25
Sharing licenceMIT · LICENSE.txt
Change size+2 −0
What the code was meant to do, written into the code itself as a save note
fix: handle function stack correctly when starting a new function in TypeScript parser
The change
| 339 | 339 | self._prev_token = token | |
| 340 | 340 | return | |
| 341 | 341 | if token == 'function': | |
| 342 | + | if self.started_function and not self.as_object: | |
| 343 | + | self._pop_function_from_stack() | |
| 342 | 344 | self._state = self._function | |
| 343 | 345 | elif token in ('if', 'switch', 'for', 'while', 'catch'): | |
| 344 | 346 | self.next(self._expecting_condition_and_statement_block) |
The check that tells the two apart
fail→pass·test/test_languages/testTypeScript.py::Test_ts_param_type_filtering::test_parameter_count_with_union_return_type_and_following_function
Check file test/test_languages/testTypeScript.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before ita1d1cac68f434044ffbfed6aeceecacaed5b42f4
Broken version dated2026-05-25
Modulelizard_languages.typescript
Units changedTypeScriptStates
Fingerprintdfa539334769ab40
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in terryyin/lizard
- 2026-08-08fix(java): do not report control structures as methods
- 2026-07-02HalsteadClassifier
- 2026-07-02fix(csv): emit columns for extensions with multiple FUNCTION_INFO fields
- 2026-06-15fix(golike): register generic functions with [...] type params
- 2026-06-15fix(java): enhance parsing of generic and qualified type names in anonymous classes
- 2026-06-11fix(script): stop a '#' comment continuing past a trailing backslash (#317)