mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 00:32:15 +03:00
fix(es/helpers): Fix loose mode (#6691)
**Related issue:** - Closes https://github.com/swc-project/swc/issues/6581.
This commit is contained in:
parent
923e4ff840
commit
5016ebed8f
19
crates/swc/tests/exec/issues-6xxx/6581/1/.swcrc
Normal file
19
crates/swc/tests/exec/issues-6xxx/6581/1/.swcrc
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"target": "es2019",
|
||||
"loose": true,
|
||||
"minify": {
|
||||
"compress": false,
|
||||
"mangle": false
|
||||
}
|
||||
},
|
||||
"module": {
|
||||
"type": "es6"
|
||||
},
|
||||
"minify": false,
|
||||
"isModule": true
|
||||
}
|
9
crates/swc/tests/exec/issues-6xxx/6581/1/exec.ts
Normal file
9
crates/swc/tests/exec/issues-6xxx/6581/1/exec.ts
Normal file
@ -0,0 +1,9 @@
|
||||
class Hoge {
|
||||
#hoge: number
|
||||
constructor() {
|
||||
this.#hoge = 42
|
||||
}
|
||||
}
|
||||
|
||||
new Hoge()
|
||||
new Hoge()
|
20
crates/swc/tests/exec/issues-6xxx/6581/2/.swcrc
Normal file
20
crates/swc/tests/exec/issues-6xxx/6581/2/.swcrc
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"target": "es2019",
|
||||
"loose": true,
|
||||
"minify": {
|
||||
"compress": false,
|
||||
"mangle": false
|
||||
},
|
||||
"externalHelpers": true
|
||||
},
|
||||
"module": {
|
||||
"type": "es6"
|
||||
},
|
||||
"minify": false,
|
||||
"isModule": true
|
||||
}
|
9
crates/swc/tests/exec/issues-6xxx/6581/2/exec.ts
Normal file
9
crates/swc/tests/exec/issues-6xxx/6581/2/exec.ts
Normal file
@ -0,0 +1,9 @@
|
||||
class Hoge {
|
||||
#hoge: number
|
||||
constructor() {
|
||||
this.#hoge = 42
|
||||
}
|
||||
}
|
||||
|
||||
new Hoge()
|
||||
new Hoge()
|
@ -3,5 +3,5 @@ export default function _classPrivateFieldBase(receiver, privateKey) {
|
||||
throw new TypeError("attempted to use private field on non-instance");
|
||||
}
|
||||
|
||||
return receiver;
|
||||
return receiver[privateKey];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user