mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(minifier): cannot transform property key #constructor (#8405)
This commit is contained in:
parent
438a6e7abc
commit
2f3a9dc74c
1 changed files with 4 additions and 1 deletions
|
|
@ -1032,7 +1032,9 @@ impl<'a, 'b> PeepholeSubstituteAlternateSyntax {
|
|||
};
|
||||
let PropertyKey::StringLiteral(s) = key else { return };
|
||||
let value = s.value.as_str();
|
||||
if matches!(value, "__proto__" | "constructor" | "prototype") {
|
||||
// Uncaught SyntaxError: Classes may not have a field named 'constructor'
|
||||
// Uncaught SyntaxError: Class constructor may not be a private method
|
||||
if matches!(value, "__proto__" | "prototype" | "constructor" | "#constructor") {
|
||||
return;
|
||||
}
|
||||
if *computed {
|
||||
|
|
@ -1785,6 +1787,7 @@ mod test {
|
|||
test_same("class C { ['prototype']() {} }");
|
||||
test_same("class C { ['__proto__']() {} }");
|
||||
test_same("class C { ['constructor']() {} }");
|
||||
test_same("class C { ['#constructor']() {} }");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue