swc/crates/swc_ecma_parser
Manish Goregaokar 5e7834aa2e
refactor(es/parser): Don't attempt to handle shebangs in read_token_number_sign (#7803)
bump() has a safety invariant that there must be input in the buffer to
read (See https://github.com/swc-project/swc/issues/7709).

This function as currently written calls `bump()` after calling
`read_token_interpreter()`, which *may* have exhausted the buffer
already in the specific case that it is handling a shebang. (The input
string `#!/bin/js` with no newline is sufficient to cause UB here)

Fortunately, shebangs never reach this function, due to `read_shebang`!
Hurray!

It's cleaner to not attempt to handle shebangs here when this code path
will never be reached, and use a debug assertion to ensure that we're
not dealing with shebangs.
2023-08-14 01:33:50 +00:00
..
benches chore(es): Rename benchmarks (#4355) 2022-04-17 18:36:15 +00:00
examples doc(es/parser): Change file extension in TypeScript example (#6094) 2022-10-10 05:02:02 +00:00
scripts test(es): Update tsc test suite (#7323) 2023-04-24 14:59:19 +00:00
src refactor(es/parser): Don't attempt to handle shebangs in read_token_number_sign (#7803) 2023-08-14 01:33:50 +00:00
tests refactor(es/parser): Do not validate top-level await with target (#7774) 2023-08-07 21:30:04 +00:00
.gitignore test(es): Update tsc test suite (#7323) 2023-04-24 14:59:19 +00:00
Cargo.toml chore: Publish crates 2023-08-10 08:01:19 +00:00
colors.js chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00