@ Nullable private static JSType getInstanceIfPrototype ( JSType maybePrototype ) { if ( maybePrototype . isFunctionPrototypeType ( ) ) { FunctionType constructor = maybePrototype . toObjectType ( ) . getOwnerFunction ( ) ; if ( constructor != null ) { if ( ! constructor . hasInstanceType ( ) ) { // this can happen when adding to the prototype of a non-constructor function return null ; } return constructor . getInstanceType ( ) ; } } return null ; }
Returns the corresponding instance if maybePrototype is a prototype of a constructor otherwise null