private void visitClass ( Node n ) { FunctionType functionType = JSType . toMaybeFunctionType ( n . getJSType ( ) ) ; Node extendsClause = n . getSecondChild ( ) ; if ( ! extendsClause . isEmpty ( ) ) { // Ensure that the `extends` clause is actually a constructor or interface. If it is, but // it's the wrong one then checkConstructor or checkInterface will warn. JSType superType = extendsClause . getJSType ( ) ; if ( superType . isConstructor ( ) || superType . isInterface ( ) ) { validator . expectExtends ( n , functionType , superType . toMaybeFunctionType ( ) ) ; } else if ( ! superType . isUnknownType ( ) ) { // Only give this error for supertypes *known* to be wrong - unresolved types are OK here. compiler . report ( JSError . make ( n , CONFLICTING_EXTENDED_TYPE , functionType . isConstructor ( ) ? "constructor" : "interface" , getBestFunctionName ( n ) ) ) ; } } if ( functionType . isConstructor ( ) ) { checkConstructor ( n , functionType ) ; } else if ( functionType . isInterface ( ) ) { checkInterface ( n , functionType ) ; } else { throw new IllegalStateException ( "CLASS node's type must be either constructor or interface: " + functionType ) ; } }
Visits a CLASS node .