only use functions returnType if it hasn't been reassigned

This commit is contained in:
Sebastian McKenzie 2015-02-13 20:36:43 +11:00
parent 56c868efee
commit ba9b85f64b

View File

@ -224,7 +224,10 @@ Scope.prototype.inferType = function (node) {
if (t.isCallExpression(target) && t.isIdentifier(target.callee)) { if (t.isCallExpression(target) && t.isIdentifier(target.callee)) {
var funcInfo = this.getBindingInfo(target.callee.name); var funcInfo = this.getBindingInfo(target.callee.name);
if (funcInfo) return funcInfo.node.returnType; if (funcInfo) {
var funcNode = funcInfo.node;
return !funcInfo.reassigned && t.isFunction(funcNode) && node.returnType;
}
} }
if (t.isIdentifier(target)) { if (t.isIdentifier(target)) {