Skip to content

Commit

Permalink
fixed files form Closure #117
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 3d4ac83 commit 2b2a1b4
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,20 @@ private String formatFoundRequired(String description, JSType found,
* to an Object type, if possible.
*/
String getReadableJSTypeName(Node n, boolean dereference) {
JSType type = getJSType(n);
if (dereference) {
ObjectType dereferenced = type.dereference();
if (dereferenced != null) {
type = dereferenced;
}
}

// The best type name is the actual type name.
if (type.isFunctionPrototypeType() ||
(type.toObjectType() != null &&
type.toObjectType().getConstructor() != null)) {
return type.toString();
}

// If we're analyzing a GETPROP, the property may be inherited by the
// prototype chain. So climb the prototype chain and find out where
Expand Down Expand Up @@ -753,18 +765,6 @@ String getReadableJSTypeName(Node n, boolean dereference) {
}
}

JSType type = getJSType(n);
if (dereference) {
ObjectType dereferenced = type.dereference();
if (dereferenced != null) {
type = dereferenced;
}
}
if (type.isFunctionPrototypeType() ||
(type.toObjectType() != null &&
type.toObjectType().getConstructor() != null)) {
return type.toString();
}
String qualifiedName = n.getQualifiedName();
if (qualifiedName != null) {
return qualifiedName;
Expand Down

0 comments on commit 2b2a1b4

Please sign in to comment.