MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / getGetterNamesForHierarchy

Function getGetterNamesForHierarchy

src/debug/dart_debug_impl.ts:1048–1069  ·  view source on GitHub ↗
(thread: VMIsolateRef, classRef: VMClassRef | undefined)

Source from the content-addressed store, hash-verified

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";

Callers

nothing calls this directly

Calls 2

uniqFunction · 0.90
getObjectMethod · 0.80

Tested by

no test coverage detected