@@ -95,7 +95,7 @@ import {
95
95
} from "./common" ;
96
96
97
97
import {
98
- uniqueMap ,
98
+ cloneMap ,
99
99
isPowerOf2
100
100
} from "./util" ;
101
101
@@ -255,7 +255,7 @@ export class Resolver extends DiagnosticEmitter {
255
255
< ClassPrototype > element ,
256
256
typeArgumentNodes ,
257
257
ctxElement ,
258
- uniqueMap < string , Type > ( ctxTypes ) , // don't inherit
258
+ cloneMap ( ctxTypes ) , // don't inherit
259
259
node ,
260
260
reportMode
261
261
) ;
@@ -309,7 +309,7 @@ export class Resolver extends DiagnosticEmitter {
309
309
typeParameterNodes ,
310
310
typeArgumentNodes ,
311
311
ctxElement ,
312
- ctxTypes = uniqueMap ( ctxTypes ) , // update
312
+ ctxTypes = cloneMap ( ctxTypes ) , // update
313
313
node ,
314
314
reportMode
315
315
) ;
@@ -626,7 +626,7 @@ export class Resolver extends DiagnosticEmitter {
626
626
/** Contextual element. */
627
627
ctxElement : Element ,
628
628
/** Contextual types, i.e. `T`. Updated in place with the new set of contextual types. */
629
- ctxTypes : Map < string , Type > = uniqueMap < string , Type > ( ) ,
629
+ ctxTypes : Map < string , Type > = new Map ( ) ,
630
630
/** Alternative report node in case of empty type arguments. */
631
631
alternativeReportNode : Node | null = null ,
632
632
/** How to proceed with eventual diagnostics. */
@@ -656,7 +656,7 @@ export class Resolver extends DiagnosticEmitter {
656
656
return null ;
657
657
}
658
658
var typeArguments = new Array < Type > ( maxParameterCount ) ;
659
- var oldCtxTypes = uniqueMap < string , Type > ( ctxTypes ) ;
659
+ var oldCtxTypes = cloneMap ( ctxTypes ) ;
660
660
ctxTypes . clear ( ) ;
661
661
for ( let i = 0 ; i < maxParameterCount ; ++ i ) {
662
662
let type = i < argumentCount
@@ -669,7 +669,7 @@ export class Resolver extends DiagnosticEmitter {
669
669
: this . resolveType ( // reports
670
670
assert ( typeParameters [ i ] . defaultType ) ,
671
671
ctxElement ,
672
- uniqueMap < string , Type > ( ctxTypes ) , // don't update
672
+ cloneMap ( ctxTypes ) , // don't update
673
673
reportMode
674
674
) ;
675
675
if ( ! type ) return null ;
@@ -704,15 +704,15 @@ export class Resolver extends DiagnosticEmitter {
704
704
prototype ,
705
705
typeArguments ,
706
706
ctxFlow . actualFunction ,
707
- uniqueMap ( ctxFlow . contextualTypeArguments ) , // don't inherit
707
+ cloneMap ( ctxFlow . contextualTypeArguments ) , // don't inherit
708
708
node ,
709
709
reportMode
710
710
) ;
711
711
}
712
712
713
713
// infer generic call if type arguments have been omitted
714
714
if ( prototype . is ( CommonFlags . GENERIC ) ) {
715
- let contextualTypeArguments = uniqueMap < string , Type > ( ctxFlow . contextualTypeArguments ) ;
715
+ let contextualTypeArguments = cloneMap ( ctxFlow . contextualTypeArguments ) ;
716
716
717
717
// fill up contextual types with auto for each generic component
718
718
let typeParameterNodes = assert ( prototype . typeParameterNodes ) ;
@@ -780,13 +780,13 @@ export class Resolver extends DiagnosticEmitter {
780
780
return this . resolveFunction (
781
781
prototype ,
782
782
resolvedTypeArguments ,
783
- uniqueMap < string , Type > ( ctxFlow . contextualTypeArguments ) ,
783
+ cloneMap ( ctxFlow . contextualTypeArguments ) ,
784
784
reportMode
785
785
) ;
786
786
}
787
787
788
788
// otherwise resolve the non-generic call as usual
789
- return this . resolveFunction ( prototype , null , uniqueMap < string , Type > ( ) , reportMode ) ;
789
+ return this . resolveFunction ( prototype , null , new Map ( ) , reportMode ) ;
790
790
}
791
791
792
792
/** Updates contextual types with a possibly encapsulated inferred type. */
@@ -1220,7 +1220,7 @@ export class Resolver extends DiagnosticEmitter {
1220
1220
var element = this . lookupIdentifierExpression ( node , ctxFlow , ctxElement , reportMode ) ;
1221
1221
if ( ! element ) return null ;
1222
1222
if ( element . kind == ElementKind . FUNCTION_PROTOTYPE ) {
1223
- let instance = this . resolveFunction ( < FunctionPrototype > element , null , uniqueMap < string , Type > ( ) , reportMode ) ;
1223
+ let instance = this . resolveFunction ( < FunctionPrototype > element , null , new Map ( ) , reportMode ) ;
1224
1224
if ( ! instance ) return null ;
1225
1225
element = instance ;
1226
1226
}
@@ -1357,7 +1357,7 @@ export class Resolver extends DiagnosticEmitter {
1357
1357
// Inherit from 'Function' if not overridden, i.e. fn.call
1358
1358
let ownMember = target . getMember ( propertyName ) ;
1359
1359
if ( ! ownMember ) {
1360
- let functionInstance = this . resolveFunction ( < FunctionPrototype > target , null , uniqueMap < string , Type > ( ) , ReportMode . SWALLOW ) ;
1360
+ let functionInstance = this . resolveFunction ( < FunctionPrototype > target , null , new Map ( ) , ReportMode . SWALLOW ) ;
1361
1361
if ( functionInstance ) {
1362
1362
let wrapper = functionInstance . type . getClassOrWrapper ( this . program ) ;
1363
1363
if ( wrapper ) target = wrapper ;
@@ -2538,7 +2538,7 @@ export class Resolver extends DiagnosticEmitter {
2538
2538
< ClassPrototype > element ,
2539
2539
node . typeArguments ,
2540
2540
ctxFlow . actualFunction ,
2541
- uniqueMap < string , Type > ( ctxFlow . contextualTypeArguments ) ,
2541
+ cloneMap ( ctxFlow . contextualTypeArguments ) ,
2542
2542
node ,
2543
2543
reportMode
2544
2544
) ;
@@ -2625,7 +2625,7 @@ export class Resolver extends DiagnosticEmitter {
2625
2625
/** Type arguments provided. */
2626
2626
typeArguments : Type [ ] | null ,
2627
2627
/** Contextual types, i.e. `T`. */
2628
- ctxTypes : Map < string , Type > = uniqueMap < string , Type > ( ) ,
2628
+ ctxTypes : Map < string , Type > = new Map ( ) ,
2629
2629
/** How to proceed with eventual diagnostics. */
2630
2630
reportMode : ReportMode = ReportMode . REPORT
2631
2631
) : Function | null {
@@ -2927,7 +2927,7 @@ export class Resolver extends DiagnosticEmitter {
2927
2927
/** Type arguments provided. */
2928
2928
typeArguments : Type [ ] | null ,
2929
2929
/** Contextual types, i.e. `T`. */
2930
- ctxTypes : Map < string , Type > = uniqueMap < string , Type > ( ) ,
2930
+ ctxTypes : Map < string , Type > = new Map ( ) ,
2931
2931
/** How to proceed with eventual diagnostics. */
2932
2932
reportMode : ReportMode = ReportMode . REPORT
2933
2933
) : Class | null {
@@ -2988,7 +2988,7 @@ export class Resolver extends DiagnosticEmitter {
2988
2988
basePrototype ,
2989
2989
extendsNode . typeArguments ,
2990
2990
prototype . parent , // relative to derived class
2991
- uniqueMap ( ctxTypes ) , // don't inherit
2991
+ cloneMap ( ctxTypes ) , // don't inherit
2992
2992
extendsNode ,
2993
2993
reportMode
2994
2994
) ;
@@ -3024,7 +3024,7 @@ export class Resolver extends DiagnosticEmitter {
3024
3024
interfacePrototype ,
3025
3025
implementsNode . typeArguments ,
3026
3026
prototype . parent ,
3027
- uniqueMap ( ctxTypes ) ,
3027
+ cloneMap ( ctxTypes ) ,
3028
3028
implementsNode ,
3029
3029
reportMode
3030
3030
) ;
@@ -3346,14 +3346,14 @@ export class Resolver extends DiagnosticEmitter {
3346
3346
operatorInstance = this . resolveFunction (
3347
3347
boundPrototype ,
3348
3348
null ,
3349
- uniqueMap < string , Type > ( ) ,
3349
+ new Map ( ) ,
3350
3350
reportMode
3351
3351
) ;
3352
3352
} else {
3353
3353
operatorInstance = this . resolveFunction (
3354
3354
overloadPrototype ,
3355
3355
null ,
3356
- uniqueMap < string , Type > ( ) ,
3356
+ new Map ( ) ,
3357
3357
reportMode
3358
3358
) ;
3359
3359
}
@@ -3491,7 +3491,7 @@ export class Resolver extends DiagnosticEmitter {
3491
3491
let getterInstance = this . resolveFunction (
3492
3492
getterPrototype ,
3493
3493
null ,
3494
- uniqueMap < string , Type > ( ) ,
3494
+ new Map ( ) ,
3495
3495
reportMode
3496
3496
) ;
3497
3497
if ( getterInstance ) {
@@ -3504,7 +3504,7 @@ export class Resolver extends DiagnosticEmitter {
3504
3504
let setterInstance = this . resolveFunction (
3505
3505
setterPrototype ,
3506
3506
null ,
3507
- uniqueMap < string , Type > ( ) ,
3507
+ new Map ( ) ,
3508
3508
reportMode
3509
3509
) ;
3510
3510
if ( setterInstance ) {
0 commit comments