@@ -19,7 +19,8 @@ import {
19
19
Global ,
20
20
Program ,
21
21
Property ,
22
- PropertyPrototype
22
+ PropertyPrototype ,
23
+ InterfacePrototype
23
24
} from "../program" ;
24
25
25
26
/** Walker base class. */
@@ -94,6 +95,10 @@ export abstract class ExportsWalker {
94
95
this . visitClassInstances ( name , < ClassPrototype > element ) ;
95
96
break ;
96
97
}
98
+ case ElementKind . InterfacePrototype : {
99
+ this . visitInterfaceInstances ( name , < InterfacePrototype > element ) ;
100
+ break ;
101
+ }
97
102
case ElementKind . PropertyPrototype : {
98
103
let propertyInstance = ( < PropertyPrototype > element ) . instance ;
99
104
if ( ! propertyInstance ) break ;
@@ -112,8 +117,13 @@ export abstract class ExportsWalker {
112
117
if ( hasCompiledMember ( element ) ) this . visitNamespace ( name , element ) ;
113
118
break ;
114
119
}
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
+ }
117
127
}
118
128
}
119
129
@@ -134,11 +144,24 @@ export abstract class ExportsWalker {
134
144
// TODO: for (let instance of instances.values()) {
135
145
for ( let _values = Map_values ( instances ) , i = 0 , k = _values . length ; i < k ; ++ i ) {
136
146
let instance = unchecked ( _values [ i ] ) ;
147
+ assert ( instance . kind == ElementKind . Class ) ;
137
148
if ( instance . is ( CommonFlags . Compiled ) ) this . visitClass ( name , instance ) ;
138
149
}
139
150
}
140
151
}
141
152
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
+
142
165
abstract visitGlobal ( name : string , element : Global ) : void ;
143
166
abstract visitEnum ( name : string , element : Enum ) : void ;
144
167
abstract visitFunction ( name : string , element : Function ) : void ;
0 commit comments