add allowPartial option to t.buildMatchMemberExpression, fix t.isReferenced on Property nodes - fixes #656
This commit is contained in:
@@ -257,8 +257,9 @@ t.isReferenced = function (node, parent) {
|
||||
}
|
||||
|
||||
// yes: { [NODE]: "" }
|
||||
if (t.isProperty(parent)) {
|
||||
return parent.key === node && parent.computed;
|
||||
// no: { NODE: "" }
|
||||
if (t.isProperty(parent) && parent.key === node) {
|
||||
return parent.computed;
|
||||
}
|
||||
|
||||
// no: var NODE = init;
|
||||
@@ -407,10 +408,11 @@ t.ensureBlock = function (node, key) {
|
||||
* parsed nodes of `React.createClass` and `React["createClass"]`.
|
||||
*
|
||||
* @param {String} match Dot delimetered string
|
||||
* @param {Boolean} [allowPartial] Allow a partial match
|
||||
* @returns {Function}
|
||||
*/
|
||||
|
||||
t.buildMatchMemberExpression = function (match) {
|
||||
t.buildMatchMemberExpression = function (match, allowPartial) {
|
||||
var parts = match.split(".");
|
||||
|
||||
return function (member) {
|
||||
@@ -445,7 +447,11 @@ t.buildMatchMemberExpression = function (match) {
|
||||
|
||||
// too many parts
|
||||
if (++i > parts.length) {
|
||||
return false;
|
||||
if (partial) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user