1 A syntax error within the expression of a template literal placeholder 2 made the compiler spin until it ran out of memory. The statement 3 terminating the placeholder expression had advanced the source position 4 beyond the last token of the expression, and instructions emitted for 5 that token afterwards moved the position backwards. The negative offset 6 was taken for an enormous one when recording the source position of the 7 instruction, which then took practically forever and a lot of memory. 8 9 1. Excess token in a placeholder. 10 11 -- Testcase -- 12 x = `a${ 1 2 }`; 13 -- End -- 14 15 -- Args -- 16 -R 17 -- End -- 18 19 -- Expect stderr -- 20 Syntax error: Unexpected token 21 Expecting '}' 22 In line 1, byte 12: 23 24 `x = `a${ 1 2 }`;` 25 ~~~~~~~~~~~^ 26 27 28 -- End -- 29 30 31 2. Unterminated placeholder at the end of the source. 32 33 -- Testcase -- 34 x = `tpl${ 35 -- End -- 36 37 -- Args -- 38 -R 39 -- End -- 40 41 -- Expect stderr -- 42 Syntax error: Expecting expression 43 In line 2, byte 1: 44 45 `x = `tpl${` 46 ^-- Near here 47 48 49 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt