Update babel-preset, filter path by identifiers.

Summary:
This PR contains [the fix](https://github.com/facebook/react-native/issues/6063#issuecomment-189416771) from #6063, which resolves the issue with rxjs 5. Is there a reason to not include these proposed changes in the repo?
Closes https://github.com/facebook/react-native/pull/10815

Differential Revision: D4226835

fbshipit-source-id: bfaeaebbe308c45bce814469ef0f75283f050d18
This commit is contained in:
Nicholas Young 2016-11-23 09:27:36 -08:00 committed by Facebook Github Bot
parent 6fef014295
commit 2121527cb8

View File

@ -24,12 +24,12 @@ module.exports = function symbolMember(babel) {
return {
visitor: {
MemberExpression(path) {
let node = path.node;
if (!isAppropriateMember(node)) {
if (!isAppropriateMember(path)) {
return;
}
let node = path.node;
path.replaceWith(
t.conditionalExpression(
t.binaryExpression(
@ -54,8 +54,11 @@ module.exports = function symbolMember(babel) {
};
};
function isAppropriateMember(node) {
return node.object.type === 'Identifier' &&
function isAppropriateMember(path) {
let node = path.node;
return path.parentPath.type !== 'AssignmentExpression' &&
node.object.type === 'Identifier' &&
node.object.name === 'Symbol' &&
node.property.type === 'Identifier';
}