| 1046 | } |
| 1047 | |
| 1048 | private async getGetterNamesForHierarchy(thread: VMIsolateRef, classRef: VMClassRef | undefined): Promise<string[]> { |
| 1049 | let getterNames: string[] = []; |
| 1050 | while (this.vmService && classRef) { |
| 1051 | const classResponse = await this.vmService.getObject(thread.id, classRef.id); |
| 1052 | if (classResponse.result.type !== "Class") |
| 1053 | break; |
| 1054 | |
| 1055 | const c = classResponse.result as VMClass; |
| 1056 | |
| 1057 | // TODO: This kinda smells for two reasons: |
| 1058 | // 1. This is supposed to be an @Function but it has loads of extra stuff on it compare to the docs |
| 1059 | // 2. We're accessing _kind to check if it's a getter :/ |
| 1060 | getterNames = getterNames.concat(getterNames, c.functions.filter((f) => f._kind === "GetterFunction" && !f.static && !f.const).map((f) => f.name)); |
| 1061 | classRef = c.super; |
| 1062 | } |
| 1063 | |
| 1064 | // Distinct the list; since we may have got dupes from the super-classes. |
| 1065 | getterNames = uniq(getterNames); |
| 1066 | |
| 1067 | // Remove _identityHashCode because it seems to throw (and probably isn't useful to the user). |
| 1068 | return getterNames.filter((g) => g !== "_identityHashCode"); |
| 1069 | } |
| 1070 | |
| 1071 | private isSimpleKind(kind: string) { |
| 1072 | return kind === "String" || kind === "Bool" || kind === "Int" || kind === "Num" || kind === "Double" || kind === "Null" || kind === "Closure"; |