<commit_before>part of angular;

/**
 * A set of functions which build on top of dart:mirrors making them
 * easier to use.
 */

// Return the value of a type's static field or null if it is not defined.
reflectStaticField(Type type, String field) {
  Symbol fieldSym = new Symbol(field);
  var reflection = reflectClass(type);
  if (!reflection.members.containsKey(fieldSym)) return null;
  if (!reflection.members[fieldSym].isStatic) return null;

  var fieldReflection = reflection.getField(fieldSym);
  if (fieldReflection == null) return null;
  return fieldReflection.reflectee;
}<commit_msg>hack(mirrors): A hack for slow reflectClass<commit_after>part of angular;

Map<Type, ClassMirror> _reflectionCache = new Map<Type, ClassMirror>();

// A hack for slow reflectClass.
ClassMirror fastReflectClass(Type type) {
  ClassMirror reflectee = _reflectionCache[type];
  if (reflectee == null) {
    reflectee = reflectClass(type);
    _reflectionCache[type] = reflectee;
  }
  return reflectee;
}

/**
 * A set of functions which build on top of dart:mirrors making them
 * easier to use.
 */

// Return the value of a type's static field or null if it is not defined.
reflectStaticField(Type type, String field) {
  Symbol fieldSym = new Symbol(field);
  var reflection = fastReflectClass(type);
  if (!reflection.members.containsKey(fieldSym)) return null;
  if (!reflection.members[fieldSym].isStatic) return null;

  var fieldReflection = reflection.getField(fieldSym);
  if (fieldReflection == null) return null;
  return fieldReflection.reflectee;
}
{'fraction_non_alphanumeric': 0.09948652118100128, 'fraction_numerical': 0.0, 'mean_word_length': 4.752767527675276, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1253881', 'n_tokens_mistral': 458, 'n_tokens_neox': 446, 'n_words': 155}