fix decorator interop - fixes #1277
This commit is contained in:
@@ -12,14 +12,10 @@ var Foo = (function () {
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}, {
|
||||
key: "__initializeProperties",
|
||||
value: function __initializeProperties() {
|
||||
this.bar = foo;
|
||||
}
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
|
||||
@@ -12,10 +12,5 @@ var Foo = (function (_Bar) {
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
})(Bar);
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
var Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = undefined;
|
||||
};
|
||||
@@ -1,15 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = "foo";
|
||||
}
|
||||
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})();
|
||||
var Foo = function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.bar = "foo";
|
||||
};
|
||||
|
||||
@@ -10,10 +10,5 @@ var Foo = (function (_Bar) {
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@@ -9,10 +9,5 @@ var Foo = (function (_Bar) {
|
||||
}
|
||||
|
||||
babelHelpers.inherits(Foo, _Bar);
|
||||
babelHelpers.createClass(Foo, [{
|
||||
key: "bar",
|
||||
value: undefined,
|
||||
enumerable: true
|
||||
}]);
|
||||
return Foo;
|
||||
})(Bar);
|
||||
@@ -0,0 +1,14 @@
|
||||
function noop() {}
|
||||
|
||||
class Foo {
|
||||
@noop
|
||||
bar = "foobar";
|
||||
|
||||
@noop
|
||||
foo() {
|
||||
return "bar";
|
||||
}
|
||||
}
|
||||
|
||||
assert.equal(new Foo().bar, "foobar");
|
||||
assert.equal(new Foo().foo(), "bar");
|
||||
@@ -5,7 +5,7 @@ var Foo = (function () {
|
||||
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.foo = _instanceInitializers.foo.call(this);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(this, "foo", _instanceInitializers);
|
||||
}
|
||||
|
||||
babelHelpers.createDecoratedClass(Foo, [{
|
||||
@@ -17,4 +17,4 @@ var Foo = (function () {
|
||||
enumerable: true
|
||||
}], null, _instanceInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
function noop() {}
|
||||
|
||||
class Foo {
|
||||
@noop
|
||||
static bar = "foobar";
|
||||
|
||||
@noop
|
||||
static foo() {
|
||||
return "bar";
|
||||
}
|
||||
}
|
||||
|
||||
assert.equal(Foo.bar, "foobar");
|
||||
assert.equal(Foo.foo(), "bar");
|
||||
@@ -15,6 +15,6 @@ var Foo = (function () {
|
||||
},
|
||||
enumerable: true
|
||||
}], null, _staticInitializers);
|
||||
Foo.foo = _staticInitializers.foo.call(Foo);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(Foo, "foo", _staticInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -5,7 +5,7 @@ var Foo = (function () {
|
||||
|
||||
function Foo() {
|
||||
babelHelpers.classCallCheck(this, Foo);
|
||||
this.foo = _instanceInitializers.foo.call(this);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(this, "foo", _instanceInitializers);
|
||||
}
|
||||
|
||||
babelHelpers.createDecoratedClass(Foo, [{
|
||||
@@ -15,4 +15,4 @@ var Foo = (function () {
|
||||
enumerable: true
|
||||
}], null, _instanceInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
})();
|
||||
@@ -13,6 +13,6 @@ var Foo = (function () {
|
||||
initializer: function () {},
|
||||
enumerable: true
|
||||
}], null, _staticInitializers);
|
||||
Foo.foo = _staticInitializers.foo.call(Foo);
|
||||
babelHelpers.defineDecoratedPropertyDescriptor(Foo, "foo", _staticInitializers);
|
||||
return Foo;
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
function override(target, key, descriptor) {
|
||||
descriptor.initializer = function () {
|
||||
return "lol";
|
||||
};
|
||||
}
|
||||
|
||||
var obj = {
|
||||
@override
|
||||
foo: "bar",
|
||||
|
||||
bar: "heh"
|
||||
};
|
||||
|
||||
assert.equal(obj.foo, "lol");
|
||||
assert.equal(obj.bar, "heh");
|
||||
@@ -3,12 +3,18 @@
|
||||
var obj = babelHelpers.createDecoratedObject([{
|
||||
key: "bar",
|
||||
decorators: [foo],
|
||||
value: function value() {}
|
||||
initializer: function initializer() {
|
||||
return function () {};
|
||||
}
|
||||
}, {
|
||||
key: "foo",
|
||||
decorators: [bar],
|
||||
value: "lol"
|
||||
initializer: function initializer() {
|
||||
return "lol";
|
||||
}
|
||||
}, {
|
||||
key: "yes",
|
||||
value: "wow"
|
||||
}]);
|
||||
initializer: function initializer() {
|
||||
return "wow";
|
||||
}
|
||||
}]);
|
||||
Reference in New Issue
Block a user