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.

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

339339 self._prev_token = token
340340 return
341341 if token == 'function':
342+ if self.started_function and not self.as_object:
343+ self._pop_function_from_stack()
342344 self._state = self._function
343345 elif token in ('if', 'switch', 'for', 'while', 'catch'):
344346 self.next(self._expecting_condition_and_statement_block)

The check that tells the two apart

failpass·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