fix corner case in unsafe (#4755)

This commit is contained in:
Alex Lam S.L
2021-03-08 20:40:21 +00:00
committed by GitHub
parent 077512d151
commit f4ee0f651c
2 changed files with 19 additions and 14 deletions

View File

@@ -847,6 +847,8 @@ unsafe_charAt_noop: {
unsafe: true,
}
input: {
s = "foo";
x = 42;
console.log(
s.charAt(0),
"string".charAt(x),
@@ -854,12 +856,15 @@ unsafe_charAt_noop: {
);
}
expect: {
s = "foo";
x = 42;
console.log(
s[0],
"string"[0 | x],
(typeof x)[0]
s[0] || "",
"string"[0 | x] || "",
(typeof x)[0] || ""
);
}
expect_stdout: "f n"
}
issue_1649: {