convert property key to computed before checking if it's a displayName property in the react transformer builder - closes #1671

This commit is contained in:
Sebastian McKenzie 2015-06-02 23:08:46 +01:00
parent 9dcceaeb40
commit ffbf5b0b47
3 changed files with 17 additions and 2 deletions

View File

@ -161,7 +161,8 @@ export default function (exports, opts) {
for (var i = 0; i < props.length; i++) { for (var i = 0; i < props.length; i++) {
var prop = props[i]; var prop = props[i];
if (t.isIdentifier(prop.key, { name: "displayName" })) { var key = t.toComputedKey(prop);
if (t.isLiteral(key, { value: "displayName" })) {
safe = false; safe = false;
break; break;
} }

View File

@ -1,6 +1,13 @@
var Whateva = React.createClass({ var Whateva = React.createClass({
displayName: "Whatever", displayName: "Whatever",
render: function render() { render: function render() {
return null; return null;
}
});
var Bar = React.createClass({
"displayName": "Ba",
render: function render() {
return null;
} }
}); });

View File

@ -4,3 +4,10 @@ var Whateva = React.createClass({
return null; return null;
} }
}); });
var Bar = React.createClass({
"displayName": "Ba",
render: function render() {
return null;
}
});