getAbstractInheritedMembers method

Map<String, InterpretedFunction> getAbstractInheritedMembers()

Returns a map of all abstract members (methods, getters, setters) inherited from superclasses. The key is the member name, the value is the abstract InterpretedFunction.

Implementation

Map<String, InterpretedFunction> getAbstractInheritedMembers() {
  final abstractMembers = <String, InterpretedFunction>{};
  InterpretedClass? current = superclass;
  while (current != null) {
    // Add abstract members from the current superclass, potentially overwriting
    // less specific ones from further up the chain (though Dart disallows this scenario statically).
    current.methods.forEach((name, func) {
      if (func.isAbstract) {
        abstractMembers.putIfAbsent(name, () => func);
      }
    });
    current.getters.forEach((name, func) {
      if (func.isAbstract) {
        abstractMembers.putIfAbsent(name, () => func);
      }
    });
    current.setters.forEach((name, func) {
      if (func.isAbstract) {
        abstractMembers.putIfAbsent(name, () => func);
      }
    });
    current = current.superclass;
  }
  return abstractMembers;
}