Whole file
terryyin/lizard
The author described this change as “fix: prevent IndexError on nested TypeScript template literals (fixes #471)”. It counts as a record because the check below fails on the code as it stood at c4d9a60c7 and passes on 35f9273b6, with nothing else changed between the two runs.
Projectterryyin/lizard
Fix saved2026-04-22
Sharing licenceMIT · LICENSE.txt
Change size+5 −0
What the code was meant to do, written into the code itself as a save note
fix: prevent IndexError on nested TypeScript template literals (fixes #471)
The change
| 98 | 98 | elif content[i] == '}': | |
| 99 | 99 | brace_count -= 1 | |
| 100 | 100 | i += 1 | |
| 101 | + | ||
| 102 | + | if brace_count > 0: | |
| 103 | + | yield token | |
| 104 | + | return | |
| 105 | + | ||
| 101 | 106 | expr = content[expr_start:i - 1] | |
| 102 | 107 | yield expr | |
| 103 | 108 | yield '}' |
The check that tells the two apart
fail→pass·test/test_languages/testTypeScript.py::Test_tokenizing_TypeScript::test_nested_template_literal_exact_tokens
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 itc4d9a60c77828cd43315a9adbc3523512fd8b19f
Broken version dated2026-04-22
Modulelizard_languages.typescript
Units changedTypeScriptReader
Fingerprintacbf64fb8706ae79
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)