X Tutup
Skip to content

Commit 39704ca

Browse files
committed
bugfix
1 parent d30982f commit 39704ca

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/lualib/Error.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ type TSTLCapturedErrorStack = Array<{
44
source: string;
55
short_src: string;
66
currentline: number;
7-
func: Function;
87
}>;
98

109
function __TS__GetErrorStack(constructor: Function): TSTLCapturedErrorStack {
@@ -13,12 +12,12 @@ function __TS__GetErrorStack(constructor: Function): TSTLCapturedErrorStack {
1312
while (true) {
1413
const info = debug.getinfo(level, "f");
1514
level += 1;
16-
if (info.func === constructor) {
17-
break;
18-
} else if (!info) {
15+
if (!info) {
1916
// constructor not in call stack
2017
level = 1;
2118
break;
19+
} else if (info.func === constructor) {
20+
break;
2221
}
2322
}
2423
while (true) {
@@ -53,7 +52,6 @@ function __TS__GetErrorString(this: void, error: Error): string {
5352
function __TS__InitErrorClass(Type: any): any {
5453
Type.prototype.__tostring = __TS__GetErrorString;
5554
return setmetatable(Type, {
56-
__index: getmetatable(Type),
5755
__call: (_self: any, message: string) => new Type(message),
5856
});
5957
}

0 commit comments

Comments
 (0)
X Tutup