@@ -2841,6 +2841,10 @@ export abstract class Element {
2841
2841
return this . parent . lookup ( name , isType ) ;
2842
2842
}
2843
2843
2844
+ lookupGenericType ( name : string ) : Type | null {
2845
+ return this . parent . lookupGenericType ( name ) ;
2846
+ }
2847
+
2844
2848
/** Adds an element as a member of this one. Reports and returns `false` if a duplicate. */
2845
2849
add ( name : string , element : DeclaredElement , localIdentifierIfImport : IdentifierExpression | null = null ) : bool {
2846
2850
var originalDeclaration = element . declaration ;
@@ -3124,6 +3128,10 @@ export class File extends Element {
3124
3128
return this . program . lookup ( name ) ; // has no meaningful parent
3125
3129
}
3126
3130
3131
+ override lookupGenericType ( name : string ) : Type | null {
3132
+ return null ;
3133
+ }
3134
+
3127
3135
/** Ensures that an element is an export of this file. */
3128
3136
ensureExport ( name : string , element : DeclaredElement ) : void {
3129
3137
var exports = this . exports ;
@@ -3687,6 +3695,14 @@ export class Function extends TypedElement {
3687
3695
registerConcreteElement ( program , this ) ;
3688
3696
}
3689
3697
3698
+ override lookupGenericType ( name : string ) : Type | null {
3699
+ let contextualTypeArguments = this . contextualTypeArguments ;
3700
+ if ( contextualTypeArguments && contextualTypeArguments . has ( name ) ) {
3701
+ return assert ( contextualTypeArguments . get ( name ) ) ;
3702
+ }
3703
+ return this . parent . lookupGenericType ( name ) ;
3704
+ }
3705
+
3690
3706
/** Gets the name of the parameter at the specified index. */
3691
3707
getParameterName ( index : i32 ) : string {
3692
3708
var parameters = ( < FunctionDeclaration > this . declaration ) . signature . parameters ;
@@ -4297,6 +4313,14 @@ export class Class extends TypedElement {
4297
4313
registerConcreteElement ( program , this ) ;
4298
4314
}
4299
4315
4316
+ override lookupGenericType ( name : string ) : Type | null {
4317
+ let contextualTypeArguments = this . contextualTypeArguments ;
4318
+ if ( contextualTypeArguments && contextualTypeArguments . has ( name ) ) {
4319
+ return assert ( contextualTypeArguments . get ( name ) ) ;
4320
+ }
4321
+ return this . parent . lookupGenericType ( name ) ;
4322
+ }
4323
+
4300
4324
/** Sets the base class. */
4301
4325
setBase ( base : Class ) : void {
4302
4326
assert ( ! this . base ) ;
0 commit comments