Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(es/preset-env): Disable all class passes for target with native class support #9774

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var _ts_decorate = require("@swc/helpers/_/_ts_decorate");
var _ts_metadata = require("@swc/helpers/_/_ts_metadata");
var _ts_param = require("@swc/helpers/_/_ts_param");
class MyClass1 {
param1;
constructor(param1){
this.param1 = param1;
}
Expand All @@ -15,6 +16,7 @@ MyClass1 = _ts_decorate._([
])
], MyClass1);
class MyClass2 {
param1;
constructor(param1){
this.param1 = param1;
}
Expand All @@ -27,6 +29,7 @@ MyClass2 = _ts_decorate._([
])
], MyClass2);
class MyClass3 {
param1;
constructor(param1){
this.param1 = param1;
}
Expand All @@ -39,6 +42,7 @@ MyClass3 = _ts_decorate._([
])
], MyClass3);
class MyClass4 {
param1;
constructor(param1){
this.param1 = param1;
}
Expand All @@ -51,6 +55,7 @@ MyClass4 = _ts_decorate._([
])
], MyClass4);
class MyClass5 {
param1;
constructor(param1){
this.param1 = param1;
}
Expand All @@ -63,6 +68,8 @@ MyClass5 = _ts_decorate._([
])
], MyClass5);
class MyClass6 {
param1;
param2;
constructor(param1, param2){
this.param1 = param1;
this.param2 = param2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ MyClass1 = _ts_decorate._([
])
], MyClass1);
class MyClass2 {
param1;
constructor(param1, param2){
this.param1 = param1;
}
Expand All @@ -27,6 +28,7 @@ MyClass2 = _ts_decorate._([
])
], MyClass2);
class MyClass3 {
param2;
constructor(param1, param2){
this.param2 = param2;
}
Expand Down
21 changes: 21 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9743/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false
},
"loose": true,
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "es6"
},
"minify": false,
"isModule": true,
"env": {
"targets": "node >= 18.18"
}
}
3 changes: 3 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9743/input/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Foo extends Bar {
handleScroll = () => { }
}
3 changes: 3 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9743/output/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Foo extends Bar {
handleScroll = ()=>{};
}
2 changes: 1 addition & 1 deletion crates/swc_ecma_preset_env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ where
pass,
Optional::new(
class_fields_use_set(assumptions.pure_getters),
assumptions.set_public_class_fields,
assumptions.set_public_class_fields && should_enable!(ClassProperties, true),
),
);

Expand Down
Loading