use a different helper if a class contains class methods to avoid non-enumerability and delegation to es6.properties.computed transformer - fixes #984, closes #986

This commit is contained in:
Sebastian McKenzie
2015-03-10 13:04:02 +11:00
parent 3bd14f9e07
commit f3bd9cbcb8
9 changed files with 122 additions and 54 deletions

View File

@@ -0,0 +1,5 @@
class Foo {
foo() {}
"foo"() {}
[bar]() {}
}

View File

@@ -0,0 +1,17 @@
const sym = Symbol();
class Foo {
[sym] () {
return 1;
}
}
class Bar extends Foo {
[sym] () {
return super[sym]() + 2;
}
}
let i = new Bar();
assert.equal(i[sym](), 3);

View File

@@ -0,0 +1,19 @@
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
babelHelpers.createComputedClass(Foo, [{
key: "foo",
value: function foo() {}
}, {
key: "foo",
value: function foo() {}
}, {
key: bar,
value: function () {}
}]);
return Foo;
})();

View File

@@ -5,17 +5,17 @@ var Foo = (function () {
babelHelpers.classCallCheck(this, Foo);
}
babelHelpers.createClass(Foo, babelHelpers.defineProperty({
bar: {
get: function () {
return babelHelpers.defineProperty(this, "bar", complex()).bar;
}
babelHelpers.createComputedClass(Foo, [{
key: "bar",
get: function () {
return babelHelpers.defineProperty(this, "bar", complex()).bar;
}
}, bar, {
}, {
key: bar,
get: function () {
return babelHelpers.defineProperty(this, bar, complex())[bar];
}
}));
}]);
return Foo;
})();