Skip to content

Commit

Permalink
馃彈 Added test for object spread argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffborg committed Mar 18, 2021
1 parent 368eb09 commit d6ec125
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions test/__fixtures__/parameter-decorator-typed/code.js
Expand Up @@ -14,6 +14,9 @@ class MyOtherClass {

@decorate('named')
method(@inject() param: Injected, @arg() schema: Schema) {}

@decorateObjectSpread()
methodWithObjectSpread(@argObjectSpread() { name }: Schema) {}
}

@Decorate
Expand Down
21 changes: 13 additions & 8 deletions test/__fixtures__/parameter-decorator-typed/output.js
@@ -1,4 +1,4 @@
var _dec, _dec2, _dec3, _class, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _class2, _class3, _dec16, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _class4, _class5;
var _dec, _dec2, _dec3, _class, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class2, _class3, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _class4, _class5;

function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }

Expand All @@ -20,7 +20,7 @@ let MyOtherClass = (_dec4 = function (target, key) {
return inject()(target, key, 0);
}, _dec13 = function (target, key) {
return arg()(target, key, 1);
}, _dec14 = Reflect.metadata("design:type", Function), _dec15 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Schema === "undefined" ? Object : Schema]), _dec4(_class2 = _dec5(_class2 = _dec6(_class2 = _dec7(_class2 = (_class3 = class MyOtherClass {
}, _dec14 = Reflect.metadata("design:type", Function), _dec15 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Schema === "undefined" ? Object : Schema]), _dec16 = decorateObjectSpread(), _dec17 = Reflect.metadata("design:type", Function), _dec18 = Reflect.metadata("design:paramtypes", [typeof Schema === "undefined" ? Object : Schema]), _dec4(_class2 = _dec5(_class2 = _dec6(_class2 = _dec7(_class2 = (_class3 = class MyOtherClass {
constructor(parameter, otherParam) {
this.parameter = parameter;
}
Expand All @@ -29,18 +29,23 @@ let MyOtherClass = (_dec4 = function (target, key) {

method(param, schema) {}

}, (_applyDecoratedDescriptor(_class3.prototype, "methodUndecorated", [_dec8, _dec9, _dec10], Object.getOwnPropertyDescriptor(_class3.prototype, "methodUndecorated"), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, "method", [_dec11, _dec12, _dec13, _dec14, _dec15], Object.getOwnPropertyDescriptor(_class3.prototype, "method"), _class3.prototype)), _class3)) || _class2) || _class2) || _class2) || _class2);
let DecoratedClass = (_dec16 = function (target, key) {
methodWithObjectSpread(@argObjectSpread()
{
name
}) {}

}, (_applyDecoratedDescriptor(_class3.prototype, "methodUndecorated", [_dec8, _dec9, _dec10], Object.getOwnPropertyDescriptor(_class3.prototype, "methodUndecorated"), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, "method", [_dec11, _dec12, _dec13, _dec14, _dec15], Object.getOwnPropertyDescriptor(_class3.prototype, "method"), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, "methodWithObjectSpread", [_dec16, _dec17, _dec18], Object.getOwnPropertyDescriptor(_class3.prototype, "methodWithObjectSpread"), _class3.prototype)), _class3)) || _class2) || _class2) || _class2) || _class2);
let DecoratedClass = (_dec19 = function (target, key) {
return inject()(target, undefined, 0);
}, _dec17 = function (target, key) {
}, _dec20 = function (target, key) {
return inject()(target, undefined, 1);
}, _dec18 = Reflect.metadata("design:type", Function), _dec19 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Injected === "undefined" ? Object : Injected]), _dec20 = decorate('example'), _dec21 = function (target, key) {
}, _dec21 = Reflect.metadata("design:type", Function), _dec22 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Injected === "undefined" ? Object : Injected]), _dec23 = decorate('example'), _dec24 = function (target, key) {
return inject()(target, key, 0);
}, _dec22 = Reflect.metadata("design:type", Function), _dec23 = Reflect.metadata("design:paramtypes", [String]), Decorate(_class4 = _dec16(_class4 = _dec17(_class4 = _dec18(_class4 = _dec19(_class4 = (_class5 = class DecoratedClass {
}, _dec25 = Reflect.metadata("design:type", Function), _dec26 = Reflect.metadata("design:paramtypes", [String]), Decorate(_class4 = _dec19(_class4 = _dec20(_class4 = _dec21(_class4 = _dec22(_class4 = (_class5 = class DecoratedClass {
constructor(module, otherModule) {
this.module = module;
}

method(param) {}

}, (_applyDecoratedDescriptor(_class5.prototype, "method", [_dec20, _dec21, _dec22, _dec23], Object.getOwnPropertyDescriptor(_class5.prototype, "method"), _class5.prototype)), _class5)) || _class4) || _class4) || _class4) || _class4) || _class4);
}, (_applyDecoratedDescriptor(_class5.prototype, "method", [_dec23, _dec24, _dec25, _dec26], Object.getOwnPropertyDescriptor(_class5.prototype, "method"), _class5.prototype)), _class5)) || _class4) || _class4) || _class4) || _class4) || _class4);

0 comments on commit d6ec125

Please sign in to comment.