-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathDescriptorGet.ts
More file actions
25 lines (21 loc) · 743 Bytes
/
DescriptorGet.ts
File metadata and controls
25 lines (21 loc) · 743 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
const getmetatable = _G.getmetatable;
const rawget = _G.rawget;
export function __TS__DescriptorGet(this: any, metatable: any, key: string): void {
while (metatable) {
const rawResult = rawget(metatable, key as any);
if (rawResult !== undefined) {
return rawResult;
}
const descriptors = rawget(metatable, "_descriptors");
if (descriptors) {
const descriptor: PropertyDescriptor = descriptors[key];
if (descriptor !== undefined) {
if (descriptor.get) {
return descriptor.get.call(this);
}
return descriptor.value;
}
}
metatable = getmetatable(metatable);
}
}