-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/decorator): Support for legacy decorators in class expressions (…
- Loading branch information
1 parent
0fc70b3
commit 8fe57ad
Showing
7 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
var _class; | ||
const foo = _class = class _class { | ||
const foo = (_class = class _class { | ||
foo(v) { | ||
return v; | ||
} | ||
}; | ||
_ts_decorate([ | ||
}, _ts_decorate([ | ||
foo | ||
], _class.prototype, "foo", null); | ||
], _class.prototype, "foo", null)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
var _class; | ||
const foo = _class = class _class { | ||
const foo = (_class = class _class { | ||
foo(v) { | ||
return v; | ||
} | ||
}; | ||
_ts_decorate([ | ||
}, _ts_decorate([ | ||
foo | ||
], _class.prototype, "foo", null); | ||
], _class.prototype, "foo", null)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"jsc": { | ||
"target": "es2016", | ||
"keepClassNames": true, | ||
"parser": { | ||
"syntax": "ecmascript", | ||
"decorators": true | ||
}, | ||
"transform": { | ||
"legacyDecorator": true, | ||
"useDefineForClassFields": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { addX, addY } from 'someLib' | ||
|
||
var C = @addX @addY class extends Component { | ||
} | ||
|
||
@addX @addY | ||
class OtherClass extends Component { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; | ||
import { addX, addY } from 'someLib'; | ||
var _class; | ||
var C = (_class = class _class extends Component { | ||
}, _class = _ts_decorate([ | ||
addX, | ||
addY | ||
], _class)); | ||
let OtherClass = class OtherClass extends Component { | ||
}; | ||
OtherClass = _ts_decorate([ | ||
addX, | ||
addY | ||
], OtherClass); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters