Skip to content

Commit e6375bf

Browse files
committed
fix failing tests
1 parent 83637a3 commit e6375bf

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/lualib/Await.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function __TS__AsyncAwaiter(this: void, generator: (this: void) => void)
5252
return __TS__Promise.resolve(result).addCallbacks(fulfilled, reject);
5353
}
5454

55-
const [success, resultOrError] = coresume(asyncCoroutine, (v: unknown) => {
55+
const [success, resultOrError] = coresume(asyncCoroutine, function(v: unknown) {
5656
resolved = true;
5757
return __TS__Promise.resolve(v).addCallbacks(resolve, reject);
5858
});

src/lualib/Promise.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ export class __TS__Promise<T> implements Promise<T> {
7676
const [success, error] = pcall(
7777
executor,
7878
undefined,
79-
v => this.resolve(v),
80-
err => this.reject(err)
79+
this.resolve.bind(this),
80+
this.reject.bind(this)
8181
);
8282
if (!success) {
8383
// When a promise executor throws, the promise should be rejected with the thrown object as reason

src/lualib/Using.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export function __TS__Using<TArgs extends Disposable[], TReturn>(
55
): TReturn {
66
let thrownError;
77
const [ok, result] = xpcall(
8-
() => cb(...args),
8+
() => cb.call(this, ...args),
99
err => (thrownError = err)
1010
);
1111

0 commit comments

Comments
 (0)