Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly update bindings of decorated class declarations (#8566)
- Loading branch information
1 parent
bf3b20a
commit e0685ad
Showing
4 changed files
with
48 additions
and
1 deletion.
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
12 changes: 12 additions & 0 deletions
12
packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8559/input.mjs
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,12 @@ | ||
import {autobind} from 'core-decorators'; | ||
|
||
export default function wrap() { | ||
return function() { | ||
class Foo { | ||
@autobind | ||
method() {} | ||
} | ||
|
||
return Foo; | ||
}; | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8559/options.json
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,7 @@ | ||
{ | ||
"targets": { "node": 8 }, | ||
"plugins": [ | ||
["proposal-decorators", { "version": "legacy" }] | ||
], | ||
"presets": ["env"] | ||
} |
20 changes: 20 additions & 0 deletions
20
packages/babel-plugin-proposal-decorators/test/fixtures/legacy-regression/8559/output.js
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,20 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = wrap; | ||
|
||
var _coreDecorators = require("core-decorators"); | ||
|
||
function wrap() { | ||
return function () { | ||
var _class; | ||
|
||
let Foo = (_class = class Foo { | ||
method() {} | ||
|
||
}, (babelHelpers.applyDecoratedDescriptor(_class.prototype, "method", [_coreDecorators.autobind], Object.getOwnPropertyDescriptor(_class.prototype, "method"), _class.prototype)), _class); | ||
return Foo; | ||
}; | ||
} |