mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 17:54:15 +03:00
Merge #363
363: Don't emit octal escape for null character followed by digit r=kdy1 a=erikdesjardins Fixes #361 Co-authored-by: Erik Desjardins <erikdesjardins@users.noreply.github.com>
This commit is contained in:
commit
31a2af103d
@ -358,6 +358,16 @@ impl<'a> Emitter<'a> {
|
||||
.replace("\r", "\\r")
|
||||
.replace("\t", "\\t")
|
||||
.replace('\u{000B}', "\\v")
|
||||
.replace("\00", "\\x000")
|
||||
.replace("\01", "\\x001")
|
||||
.replace("\02", "\\x002")
|
||||
.replace("\03", "\\x003")
|
||||
.replace("\04", "\\x004")
|
||||
.replace("\05", "\\x005")
|
||||
.replace("\06", "\\x006")
|
||||
.replace("\07", "\\x007")
|
||||
.replace("\08", "\\x008")
|
||||
.replace("\09", "\\x009")
|
||||
.replace("\0", "\\0");
|
||||
// let value = node.value.replace("\n", "\\n");
|
||||
|
||||
|
@ -158,6 +158,20 @@ a;",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_octal_escape() {
|
||||
test_from_to(
|
||||
r#"'\x00a';
|
||||
'\x000';
|
||||
'\x001';
|
||||
'\x009'"#,
|
||||
r#"'\0a';
|
||||
'\x000';
|
||||
'\x001';
|
||||
'\x009';"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct Buf(Arc<RwLock<Vec<u8>>>);
|
||||
impl Write for Buf {
|
||||
|
Loading…
Reference in New Issue
Block a user