Skip to content

Commit 84762b8

Browse files
committed
fix(transformer): Adjust the Scope bind interface to make it work for forked extensions
1 parent 079c3f0 commit 84762b8

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/transformer/genericDeclaration/genericDeclaration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ export function GenericDeclaration(scope: Scope): IGenericDeclaration {
167167
}
168168
}
169169

170-
if (!typeParameterDeclaration || !scope.isBound()) {
171-
genericValueDescriptor = GetDescriptor(genericNode, (new Scope(declarationKey)).bind());
170+
if (!typeParameterDeclaration || !scope.isBoundFor(extensionDeclarationKey)) {
171+
genericValueDescriptor = GetDescriptor(genericNode, (new Scope(declarationKey)).bindFor(extensionDeclarationKey));
172172
}
173173

174174
const genericParameter: GenericParameter = createGenericParameter(

src/transformer/scope/scope.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,24 @@ import * as ts from 'typescript';
33
export type InterfaceOrClassDeclaration = ts.InterfaceDeclaration | ts.ClassDeclaration;
44
export class Scope {
55
constructor(currentMockKey?: string) {
6-
this._bound = false;
76
this._currentMockKey = currentMockKey;
87
}
98

109
private readonly _currentMockKey: string | undefined;
11-
private _bound: boolean;
10+
private _boundFor: string | undefined;
1211

1312
private _appendConstructorMarker(): string {
14-
return this._bound ? '_C' : '';
13+
return this._boundFor !== undefined ? '_C' : '';
1514
}
1615

17-
public bind(): this {
18-
this._bound = true;
16+
public bindFor(key: string): this {
17+
this._boundFor = key;
1918

2019
return this;
2120
}
2221

23-
public isBound(): boolean {
24-
return this._bound;
22+
public isBoundFor(key: string): boolean {
23+
return this._boundFor === key;
2524
}
2625

2726
public get currentMockKey(): string | undefined {

0 commit comments

Comments
 (0)