mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
fix(ecmascript): mark new Symbol as non side-effect free (#17568)
 `new Symbol` throws an error
This commit is contained in:
1 parent
2e8f469255
commit
1044116c75
2 files changed
+2
-2
No files matched your search
@@ -248,7 +248,7 @@ fn is_pure_call(name: &str) -> bool {
|
||||
fn is_pure_constructor(name: &str) -> bool {
|
||||
matches!(name, "Set" | "Map" | "WeakSet" | "WeakMap" | "ArrayBuffer" | "Date"
|
||||
| "Boolean" | "Error" | "EvalError" | "RangeError" | "ReferenceError"
|
||||
| "SyntaxError" | "TypeError" | "URIError" | "Number" | "Object" | "String" | "Symbol")
|
||||
| "SyntaxError" | "TypeError" | "URIError" | "Number" | "Object" | "String")
|
||||
}
|
||||
|
||||
/// Whether the name matches any known global constructors.
|
||||
|
||||
@@ -785,6 +785,7 @@ fn test_property_access() {
|
||||
fn test_new_expressions() {
|
||||
test("new AggregateError", true);
|
||||
test("new DataView", true);
|
||||
test("new Symbol", true);
|
||||
test("new Set", false);
|
||||
test("new Map", false);
|
||||
test("new WeakSet", false);
|
||||
@@ -803,7 +804,6 @@ fn test_new_expressions() {
|
||||
test("new Number", false);
|
||||
test("new Object", false);
|
||||
test("new String", false);
|
||||
test("new Symbol", false);
|
||||
}
|
||||
|
||||
// `PF` in <https://github.com/rollup/rollup/blob/master/src/ast/nodes/shared/knownGlobals.ts>
|
||||
|
||||
Reference in new issue
Block a user