Compare commits

...

11 Commits

Author SHA1 Message Date
Sebastian McKenzie
16a94a769a v3.1.1 2015-01-30 11:02:28 +11:00
Sebastian McKenzie
f7c7918efe add 3.1.1 changelog 2015-01-30 11:00:43 +11:00
Sebastian McKenzie
bf393c025f properly transform XJSIdentifier nodes referencing this into a ThisExpression - facebook/react#2927 2015-01-30 11:00:37 +11:00
Sebastian McKenzie
bbbc9c0c5e remove redundant enumerable: true property on class methods 2015-01-30 10:44:33 +11:00
Sebastian McKenzie
579db9107f fix link in 3.1.0 changelog - thanks @AluisioASG - closes #641 2015-01-30 10:42:52 +11:00
Sebastian McKenzie
d1d30e9ec9 3.1.0 2015-01-30 10:15:09 +11:00
Sebastian McKenzie
ee782f93c4 v3.1.0 2015-01-30 10:13:50 +11:00
Sebastian McKenzie
9ed6aa48a0 add esdiscuss link to class enumerability change - @thejameskyle 2015-01-30 10:11:26 +11:00
Sebastian McKenzie
ecebedd5a2 update esnext class tests 2015-01-30 10:11:11 +11:00
Sebastian McKenzie
31df576d26 make class methods nonenumerable - fixes #639 2015-01-30 10:05:17 +11:00
Sebastian McKenzie
63d6335d99 3.0.16 2015-01-30 00:18:32 +11:00
22 changed files with 40 additions and 26 deletions

View File

@@ -11,6 +11,18 @@
_Note: Gaps between patch versions are faulty/broken releases._
## 3.1.1
* **Polish**
* Drop `enumerable: false` clause from class method definitions as `enumerable` already defaults to `false`.
* **Bug Fix**
* Properly transform `XJSIdentifier` nodes referencing `this` into a `ThisExpression`.
## 3.1.0
* **Breaking Change**
* [Make class methods unenumerable](https://esdiscuss.org/topic/classes-and-enumerability#content-61).
## 3.0.16
* **Bug Fix**

View File

@@ -231,6 +231,7 @@ Class.prototype.pushMethod = function (node) {
}
util.pushMutatorMap(mutatorMap, methodName, kind, node.computed, node);
util.pushMutatorMap(mutatorMap, methodName, "enumerable", node.computed, false);
};
/**

View File

@@ -8,8 +8,10 @@
var esutils = require("esutils");
var t = require("../../../types");
exports.JSXIdentifier = function (node) {
if (esutils.keyword.isIdentifierName(node.name)) {
exports.JSXIdentifier = function (node, parent) {
if (node.name === "this" && t.isReferenced(node, parent)) {
return t.thisExpression();
} else if (esutils.keyword.isIdentifierName(node.name)) {
node.type = "Identifier";
} else {
return t.literal(node.name);

View File

@@ -81,7 +81,7 @@ exports.sourceMapToComment = function (map) {
return "//# sourceMappingURL=data:application/json;base64," + base64;
};
exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) {
exports.pushMutatorMap = function (mutatorMap, key, kind, computed, value) {
var alias;
if (t.isIdentifier(key)) {
@@ -106,7 +106,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, computed, method) {
map._computed = true;
}
map[kind] = method;
map[kind] = value;
};
exports.buildDefineProperties = function (mutatorMap) {
@@ -121,7 +121,12 @@ exports.buildDefineProperties = function (mutatorMap) {
map.writable = t.literal(true);
}
map.enumerable = t.literal(true);
if (map.enumerable === false) {
delete map.enumerable;
} else {
map.enumerable = t.literal(true);
}
map.configurable = t.literal(true);
each(map, function (node, key) {

View File

@@ -1,7 +1,7 @@
{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "3.0.16",
"version": "3.1.1",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://6to5.org/",
"repository": "6to5/6to5",

View File

@@ -1,7 +1,7 @@
{
"name": "6to5-runtime",
"description": "6to5 selfContained runtime",
"version": "3.0.15",
"version": "3.1.0",
"repository": "6to5/6to5",
"author": "Sebastian McKenzie <sebmck@gmail.com>"
}

View File

@@ -17,4 +17,4 @@ for (var key in point) {
}
assert.equal(point.toString(), '(1, 2)');
assert.deepEqual(keys.sort(), ['toString', 'x', 'y']);
assert.deepEqual(keys.sort(), ['x', 'y']);

View File

@@ -25,4 +25,4 @@ var forLoopProperties = [];
for (var key in mazer) {
forLoopProperties.push(key);
}
assert.ok(forLoopProperties.indexOf('name') >= 0, 'getters/setters are enumerable');
assert.ok(forLoopProperties.indexOf('name') === -1, 'getters/setters should be unenumerable');

View File

@@ -13,10 +13,9 @@ var Foo = (function () {
var wat = yield bar();
}),
writable: true,
enumerable: true,
configurable: true
}
});
return Foo;
})();
})();

View File

@@ -13,10 +13,9 @@ var Foo = (function () {
var wat = yield bar();
}),
writable: true,
enumerable: true,
configurable: true
}
});
return Foo;
})();
})();

View File

@@ -32,7 +32,6 @@ var Test = (function (Foo) {
(_get2 = _get(Object.getPrototypeOf(Test), "foo", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
},
writable: true,
enumerable: true,
configurable: true
}
}, {
@@ -44,7 +43,6 @@ var Test = (function (Foo) {
(_get2 = _get(Object.getPrototypeOf(Test.prototype), "test", this)).call.apply(_get2, [this, "test"].concat(_slice.call(arguments)));
},
writable: true,
enumerable: true,
configurable: true
}
});

View File

@@ -20,7 +20,6 @@ var Test = (function (Foo) {
return _get(Object.getPrototypeOf(Test), "wow", this).call(this);
},
writable: true,
enumerable: true,
configurable: true
}
});

View File

@@ -13,7 +13,6 @@ var Test = (function () {
set: function (val) {
this._test = val;
},
enumerable: true,
configurable: true
}
});

View File

@@ -10,7 +10,6 @@ var Test = (function () {
get: function () {
return 5 + 5;
},
enumerable: true,
configurable: true
}
});

View File

@@ -11,7 +11,6 @@ var Test = (function () {
return 5 + 5;
},
writable: true,
enumerable: true,
configurable: true
}
});

View File

@@ -10,7 +10,6 @@ var Test = (function () {
set: function (val) {
this._test = val;
},
enumerable: true,
configurable: true
}
});

View File

@@ -19,7 +19,6 @@ var BaseView = (function () {
this.autoRender = true;
},
writable: true,
enumerable: true,
configurable: true
}
});

View File

@@ -9,13 +9,11 @@ var A = (function () {
a: {
value: function a() {},
writable: true,
enumerable: true,
configurable: true
},
b: {
get: function () {},
set: function (b) {},
enumerable: true,
configurable: true
}
});

View File

@@ -12,14 +12,12 @@ var Foo = (function () {
get: function () {
return _defineProperty(this, "bar", complex()).bar;
},
enumerable: true,
configurable: true
}
}, bar, {
get: function () {
return _defineProperty(this, bar, complex())[bar];
},
enumerable: true,
configurable: true
}));

View File

@@ -0,0 +1,3 @@
var foo = function () {
return () => <this />;
};

View File

@@ -0,0 +1,6 @@
var foo = function () {
var _this = this;
return function () {
return React.createElement(_this, null);
};
};

View File

@@ -10,7 +10,6 @@ var Test = (function () {
get: function () {
throw new Error("wow");
},
enumerable: true,
configurable: true
}
});