@@ -19,7 +19,8 @@ import {
1919 Global ,
2020 Program ,
2121 Property ,
22- PropertyPrototype
22+ PropertyPrototype ,
23+ InterfacePrototype
2324} from "../program" ;
2425
2526/** Walker base class. */
@@ -94,6 +95,10 @@ export abstract class ExportsWalker {
9495 this . visitClassInstances ( name , < ClassPrototype > element ) ;
9596 break ;
9697 }
98+ case ElementKind . InterfacePrototype : {
99+ this . visitInterfaceInstances ( name , < InterfacePrototype > element ) ;
100+ break ;
101+ }
97102 case ElementKind . PropertyPrototype : {
98103 let propertyInstance = ( < PropertyPrototype > element ) . instance ;
99104 if ( ! propertyInstance ) break ;
@@ -112,8 +117,13 @@ export abstract class ExportsWalker {
112117 if ( hasCompiledMember ( element ) ) this . visitNamespace ( name , element ) ;
113118 break ;
114119 }
115- case ElementKind . TypeDefinition : break ;
116- default : assert ( false ) ;
120+ case ElementKind . TypeDefinition :
121+ case ElementKind . IndexSignature : break ;
122+ default : {
123+ // Not (directly) reachable exports:
124+ // File, Local, Function, Class, Interface
125+ assert ( false ) ;
126+ }
117127 }
118128 }
119129
@@ -134,11 +144,24 @@ export abstract class ExportsWalker {
134144 // TODO: for (let instance of instances.values()) {
135145 for ( let _values = Map_values ( instances ) , i = 0 , k = _values . length ; i < k ; ++ i ) {
136146 let instance = unchecked ( _values [ i ] ) ;
147+ assert ( instance . kind == ElementKind . Class ) ;
137148 if ( instance . is ( CommonFlags . Compiled ) ) this . visitClass ( name , instance ) ;
138149 }
139150 }
140151 }
141152
153+ private visitInterfaceInstances ( name : string , element : InterfacePrototype ) : void {
154+ let instances = element . instances ;
155+ if ( instances ) {
156+ // TODO: for (let instance of instances.values()) {
157+ for ( let _values = Map_values ( instances ) , i = 0 , k = _values . length ; i < k ; ++ i ) {
158+ let instance = < Interface > unchecked ( _values [ i ] ) ;
159+ assert ( instance . kind == ElementKind . Interface ) ;
160+ if ( instance . is ( CommonFlags . Compiled ) ) this . visitInterface ( name , instance ) ;
161+ }
162+ }
163+ }
164+
142165 abstract visitGlobal ( name : string , element : Global ) : void ;
143166 abstract visitEnum ( name : string , element : Enum ) : void ;
144167 abstract visitFunction ( name : string , element : Function ) : void ;
0 commit comments