getNodeOfElement function

AnnotatedNode getNodeOfElement (
  1. Element e
)

Implementation

AnnotatedNode getNodeOfElement(Element e) {
  if (e == null || e.isSynthetic) return null;
  if (!(e is ClassElement && e.isEnum)) return e.computeNode() as AnnotatedNode;
  return e.library.units
      .expand((u) => u
          .computeNode()
          .declarations
          .where((d) => d is EnumDeclaration && d.name.name == e.name))
      .first;
}