(at: number, nesting: number)
| 254 | |
| 255 | /** The offset after the template literal at `at`, or -1. */ |
| 256 | const templateEnd = (at: number, nesting: number): number => { |
| 257 | if (nesting > MAX_TEMPLATE_NESTING || wasted > limit) return -1; |
| 258 | let j = at + 1; |
| 259 | while (j < n) { |
| 260 | const c = source.charCodeAt(j); |
| 261 | if (c === Ch.Backslash) j += 2; |
| 262 | else if (c === Ch.Backtick) return j + 1; |
| 263 | else if (c === Ch.Dollar && source.charCodeAt(j + 1) === Ch.OpenBrace) { |
| 264 | const end = expressionEnd(j + 1, nesting + 1); |
| 265 | if (end < 0) break; |
| 266 | j = end; |
| 267 | } else j++; |
| 268 | } |
| 269 | wasted += j - at; |
| 270 | return -1; |
| 271 | }; |
| 272 | |
| 273 | /** The offset after the `}` that closes the `{` at `at`, or -1. */ |
| 274 | const expressionEnd = (at: number, nesting: number): number => { |
no test coverage detected