protected void generateAnonymousClassDefinition ( AnonymousClass anonClass , IAppendable it , IExtraLanguageGeneratorContext context ) { if ( ! it . hasName ( anonClass ) && it instanceof PyAppendable ) { final LightweightTypeReference jvmAnonType = getExpectedType ( anonClass ) ; final String anonName = it . declareSyntheticVariable ( anonClass , jvmAnonType . getSimpleName ( ) ) ; QualifiedName anonQualifiedName = QualifiedName . create ( jvmAnonType . getType ( ) . getQualifiedName ( ) . split ( Pattern . quote ( "." ) ) ) ; //$NON-NLS-1$ anonQualifiedName = anonQualifiedName . skipLast ( 1 ) ; if ( anonQualifiedName . isEmpty ( ) ) { // The type resolver does not include the enclosing class. assert anonClass . getDeclaringType ( ) == null : "The Xtend API has changed the AnonymousClass definition!" ; //$NON-NLS-1$ final XtendTypeDeclaration container = EcoreUtil2 . getContainerOfType ( anonClass . eContainer ( ) , XtendTypeDeclaration . class ) ; anonQualifiedName = anonQualifiedName . append ( this . qualifiedNameProvider . getFullyQualifiedName ( container ) ) ; } anonQualifiedName = anonQualifiedName . append ( anonName ) ; it . openPseudoScope ( ) ; final IRootGenerator rootGenerator = context . getRootGenerator ( ) ; assert rootGenerator instanceof PyGenerator ; final List < JvmTypeReference > types = new ArrayList <> ( ) ; for ( final JvmTypeReference superType : anonClass . getConstructorCall ( ) . getConstructor ( ) . getDeclaringType ( ) . getSuperTypes ( ) ) { if ( ! Object . class . getCanonicalName ( ) . equals ( superType . getIdentifier ( ) ) ) { types . add ( superType ) ; } } ( ( PyGenerator ) rootGenerator ) . generateTypeDeclaration ( anonQualifiedName . toString ( ) , anonName , false , types , getTypeBuilder ( ) . getDocumentation ( anonClass ) , false , anonClass . getMembers ( ) , ( PyAppendable ) it , context , null ) ; it . closeScope ( ) ; } }
Generate the anonymous class definition .