Skip to content

Commit cbd49f9

Browse files
committed
Revert "Fix different function (address) return on use bind, on object method"
This reverts commit 34067d1.
1 parent 34067d1 commit cbd49f9

2 files changed

Lines changed: 0 additions & 27 deletions

File tree

src/lualib/FunctionBind.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@ export function __TS__FunctionBind(
33
fn: (this: void, ...argArray: any[]) => any,
44
...boundArgs: any[]
55
): (...args: any[]) => any {
6-
if (typeof boundArgs[0] === "object") {
7-
const address = tostring(fn);
8-
const bound = boundArgs[0];
9-
if (!bound.__TS__wrappedMethods) bound.__TS__wrappedMethods = {};
10-
if (!bound.__TS__wrappedMethods[address]) {
11-
bound.__TS__wrappedMethods[address] = (...args: any[]) => {
12-
args.unshift(...boundArgs);
13-
return fn(...args);
14-
};
15-
}
16-
return bound.__TS__wrappedMethods[address];
17-
}
18-
196
return (...args: any[]) => {
207
args.unshift(...boundArgs);
218
return fn(...args);

test/unit/classes/classes.spec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,6 @@ test("ClassMethodCall", () => {
315315
`.expectToMatchJsResult();
316316
});
317317

318-
test("ClassMethodHasSameAddressAfterBinding", () => {
319-
util.testFunction`
320-
class a {
321-
public isSame() {
322-
let cb1 = '' + this.method.bind(this)
323-
let cb2 = '' + this.method.bind(this)
324-
return cb1 === cb2
325-
}
326-
public method() {}
327-
}
328-
return new a().isSame();
329-
`.expectToEqual(true);
330-
});
331-
332318
test("ClassNumericLiteralMethodCall", () => {
333319
util.testFunction`
334320
class a {

0 commit comments

Comments
 (0)