Lyricdev
GitHub

LYR-MIG0313

an argument written twice

hint · spec 14-cli

A note of lyric fix --from-4: s.substring(start, count) is written with an end, start + count, and a start that calls something now runs twice.

Explanation

Lyric 4's substring took a start and a count; Lyric 5's takes a start and an end, both in characters, and gives a view. The migration writes s.substring(start, start + count).toString(), which gives what Lyric 4 gave. An argument that calls a function is written twice and runs twice.

Where the call does more than compute, keep its value in a let first.

Example

proposal[LYR-MIG0313] main.lyr:15:68: 'at()' is written twice and runs twice: 'substring' takes an end in Lyric 5, not a count — where it does more than compute, keep its value in a 'let' first