removeIgnoreGpt function

void removeIgnoreGpt({
  1. required Map<String, dynamic> map,
})

Remove all entries from map that have the "ignoreGpt" modifier. This method removes the entries in-place.

Implementation

void removeIgnoreGpt({
  required Map<String, dynamic> map,
}) {
  final keysToRemove = <String>[];
  for (final entry in map.entries) {
    if (NodeUtils.parseModifiers(entry.key).modifiers.containsKey(ignoreGpt)) {
      keysToRemove.add(entry.key);
    } else if (entry.value is Map<String, dynamic>) {
      removeIgnoreGpt(map: entry.value);
    }
  }

  for (final key in keysToRemove) {
    map.remove(key);
  }
}