Summary
Python's _ discard pattern in tuple unpacking is transpiled to JS destructuring without declaring _, producing a ReferenceError at runtime.
Reproduction
Source Python:
token_type, _ = self._lex_peek_operator()
Transpiled JS:
[token_type, _] = this._lex_peek_operator();
_ is never declared with let/const, so this fails with ReferenceError: _ is not defined.
Expected JS (option A — empty slot):
[token_type, ] = this._lex_peek_operator();
Expected JS (option B — declare throwaway):
let _;
[token_type, _] = this._lex_peek_operator();
Impact
2 instances in the Parable transpilation, both in _parse_simple_pipeline. Causes a crash when parsing any pipeline expression.
Discovered via ldayton/Parable#413.
Summary
Python's
_discard pattern in tuple unpacking is transpiled to JS destructuring without declaring_, producing aReferenceErrorat runtime.Reproduction
Source Python:
Transpiled JS:
_is never declared withlet/const, so this fails withReferenceError: _ is not defined.Expected JS (option A — empty slot):
Expected JS (option B — declare throwaway):
Impact
2 instances in the Parable transpilation, both in
_parse_simple_pipeline. Causes a crash when parsing any pipeline expression.Discovered via ldayton/Parable#413.