-
-
Notifications
You must be signed in to change notification settings - Fork 686
Expand file tree
/
Copy pathfunction.ts
More file actions
38 lines (30 loc) · 837 Bytes
/
function.ts
File metadata and controls
38 lines (30 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
type auto = i32;
@final export abstract class Function<T> {
private _index: u32;
private _env: usize;
// @ts-ignore: this on getter
get index(this: T): u32 {
return load<u32>(changetype<usize>(this), offsetof<Function<T>>("_index"));
}
// @ts-ignore: this on getter
get name(this: T): string {
return "";
}
// @ts-ignore: this on getter
get length(this: T): i32 {
// @ts-ignore: T is function
return lengthof<T>();
}
// @ts-ignore: T is function
@builtin call(thisArg: thisof<T> | null, ...args: auto[]): returnof<T> {
return unreachable();
}
toString(this: T): string {
return "function() { [native code] }";
}
// RT integration
@unsafe private __visit(cookie: u32): void {
// Env is either `null` (nop) or compiler-generated
__visit(this._env, cookie);
}
}