@@ -95,7 +95,7 @@ import {
9595} from "./common" ;
9696
9797import {
98- uniqueMap ,
98+ cloneMap ,
9999 isPowerOf2
100100} from "./util" ;
101101
@@ -255,7 +255,7 @@ export class Resolver extends DiagnosticEmitter {
255255 < ClassPrototype > element ,
256256 typeArgumentNodes ,
257257 ctxElement ,
258- uniqueMap < string , Type > ( ctxTypes ) , // don't inherit
258+ cloneMap ( ctxTypes ) , // don't inherit
259259 node ,
260260 reportMode
261261 ) ;
@@ -309,7 +309,7 @@ export class Resolver extends DiagnosticEmitter {
309309 typeParameterNodes ,
310310 typeArgumentNodes ,
311311 ctxElement ,
312- ctxTypes = uniqueMap ( ctxTypes ) , // update
312+ ctxTypes = cloneMap ( ctxTypes ) , // update
313313 node ,
314314 reportMode
315315 ) ;
@@ -626,7 +626,7 @@ export class Resolver extends DiagnosticEmitter {
626626 /** Contextual element. */
627627 ctxElement : Element ,
628628 /** 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 ( ) ,
630630 /** Alternative report node in case of empty type arguments. */
631631 alternativeReportNode : Node | null = null ,
632632 /** How to proceed with eventual diagnostics. */
@@ -656,7 +656,7 @@ export class Resolver extends DiagnosticEmitter {
656656 return null ;
657657 }
658658 var typeArguments = new Array < Type > ( maxParameterCount ) ;
659- var oldCtxTypes = uniqueMap < string , Type > ( ctxTypes ) ;
659+ var oldCtxTypes = cloneMap ( ctxTypes ) ;
660660 ctxTypes . clear ( ) ;
661661 for ( let i = 0 ; i < maxParameterCount ; ++ i ) {
662662 let type = i < argumentCount
@@ -669,7 +669,7 @@ export class Resolver extends DiagnosticEmitter {
669669 : this . resolveType ( // reports
670670 assert ( typeParameters [ i ] . defaultType ) ,
671671 ctxElement ,
672- uniqueMap < string , Type > ( ctxTypes ) , // don't update
672+ cloneMap ( ctxTypes ) , // don't update
673673 reportMode
674674 ) ;
675675 if ( ! type ) return null ;
@@ -704,15 +704,15 @@ export class Resolver extends DiagnosticEmitter {
704704 prototype ,
705705 typeArguments ,
706706 ctxFlow . actualFunction ,
707- uniqueMap ( ctxFlow . contextualTypeArguments ) , // don't inherit
707+ cloneMap ( ctxFlow . contextualTypeArguments ) , // don't inherit
708708 node ,
709709 reportMode
710710 ) ;
711711 }
712712
713713 // infer generic call if type arguments have been omitted
714714 if ( prototype . is ( CommonFlags . GENERIC ) ) {
715- let contextualTypeArguments = uniqueMap < string , Type > ( ctxFlow . contextualTypeArguments ) ;
715+ let contextualTypeArguments = cloneMap ( ctxFlow . contextualTypeArguments ) ;
716716
717717 // fill up contextual types with auto for each generic component
718718 let typeParameterNodes = assert ( prototype . typeParameterNodes ) ;
@@ -780,13 +780,13 @@ export class Resolver extends DiagnosticEmitter {
780780 return this . resolveFunction (
781781 prototype ,
782782 resolvedTypeArguments ,
783- uniqueMap < string , Type > ( ctxFlow . contextualTypeArguments ) ,
783+ cloneMap ( ctxFlow . contextualTypeArguments ) ,
784784 reportMode
785785 ) ;
786786 }
787787
788788 // 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 ) ;
790790 }
791791
792792 /** Updates contextual types with a possibly encapsulated inferred type. */
@@ -1220,7 +1220,7 @@ export class Resolver extends DiagnosticEmitter {
12201220 var element = this . lookupIdentifierExpression ( node , ctxFlow , ctxElement , reportMode ) ;
12211221 if ( ! element ) return null ;
12221222 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 ) ;
12241224 if ( ! instance ) return null ;
12251225 element = instance ;
12261226 }
@@ -1357,7 +1357,7 @@ export class Resolver extends DiagnosticEmitter {
13571357 // Inherit from 'Function' if not overridden, i.e. fn.call
13581358 let ownMember = target . getMember ( propertyName ) ;
13591359 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 ) ;
13611361 if ( functionInstance ) {
13621362 let wrapper = functionInstance . type . getClassOrWrapper ( this . program ) ;
13631363 if ( wrapper ) target = wrapper ;
@@ -2538,7 +2538,7 @@ export class Resolver extends DiagnosticEmitter {
25382538 < ClassPrototype > element ,
25392539 node . typeArguments ,
25402540 ctxFlow . actualFunction ,
2541- uniqueMap < string , Type > ( ctxFlow . contextualTypeArguments ) ,
2541+ cloneMap ( ctxFlow . contextualTypeArguments ) ,
25422542 node ,
25432543 reportMode
25442544 ) ;
@@ -2625,7 +2625,7 @@ export class Resolver extends DiagnosticEmitter {
26252625 /** Type arguments provided. */
26262626 typeArguments : Type [ ] | null ,
26272627 /** Contextual types, i.e. `T`. */
2628- ctxTypes : Map < string , Type > = uniqueMap < string , Type > ( ) ,
2628+ ctxTypes : Map < string , Type > = new Map ( ) ,
26292629 /** How to proceed with eventual diagnostics. */
26302630 reportMode : ReportMode = ReportMode . REPORT
26312631 ) : Function | null {
@@ -2927,7 +2927,7 @@ export class Resolver extends DiagnosticEmitter {
29272927 /** Type arguments provided. */
29282928 typeArguments : Type [ ] | null ,
29292929 /** Contextual types, i.e. `T`. */
2930- ctxTypes : Map < string , Type > = uniqueMap < string , Type > ( ) ,
2930+ ctxTypes : Map < string , Type > = new Map ( ) ,
29312931 /** How to proceed with eventual diagnostics. */
29322932 reportMode : ReportMode = ReportMode . REPORT
29332933 ) : Class | null {
@@ -2988,7 +2988,7 @@ export class Resolver extends DiagnosticEmitter {
29882988 basePrototype ,
29892989 extendsNode . typeArguments ,
29902990 prototype . parent , // relative to derived class
2991- uniqueMap ( ctxTypes ) , // don't inherit
2991+ cloneMap ( ctxTypes ) , // don't inherit
29922992 extendsNode ,
29932993 reportMode
29942994 ) ;
@@ -3024,7 +3024,7 @@ export class Resolver extends DiagnosticEmitter {
30243024 interfacePrototype ,
30253025 implementsNode . typeArguments ,
30263026 prototype . parent ,
3027- uniqueMap ( ctxTypes ) ,
3027+ cloneMap ( ctxTypes ) ,
30283028 implementsNode ,
30293029 reportMode
30303030 ) ;
@@ -3346,14 +3346,14 @@ export class Resolver extends DiagnosticEmitter {
33463346 operatorInstance = this . resolveFunction (
33473347 boundPrototype ,
33483348 null ,
3349- uniqueMap < string , Type > ( ) ,
3349+ new Map ( ) ,
33503350 reportMode
33513351 ) ;
33523352 } else {
33533353 operatorInstance = this . resolveFunction (
33543354 overloadPrototype ,
33553355 null ,
3356- uniqueMap < string , Type > ( ) ,
3356+ new Map ( ) ,
33573357 reportMode
33583358 ) ;
33593359 }
@@ -3491,7 +3491,7 @@ export class Resolver extends DiagnosticEmitter {
34913491 let getterInstance = this . resolveFunction (
34923492 getterPrototype ,
34933493 null ,
3494- uniqueMap < string , Type > ( ) ,
3494+ new Map ( ) ,
34953495 reportMode
34963496 ) ;
34973497 if ( getterInstance ) {
@@ -3504,7 +3504,7 @@ export class Resolver extends DiagnosticEmitter {
35043504 let setterInstance = this . resolveFunction (
35053505 setterPrototype ,
35063506 null ,
3507- uniqueMap < string , Type > ( ) ,
3507+ new Map ( ) ,
35083508 reportMode
35093509 ) ;
35103510 if ( setterInstance ) {
0 commit comments