ModelElement.fromElement constructor

ModelElement.fromElement(
  1. Element e,
  2. PackageGraph p
)

Creates a ModelElement from e.

Implementation

factory ModelElement.fromElement(Element e, PackageGraph p) {
  var lib = p.findButDoNotCreateLibraryFor(e);
  if (e is PropertyInducingElement) {
    var getter =
        e.getter != null ? ModelElement.from(e.getter, lib, p) : null;
    var setter =
        e.setter != null ? ModelElement.from(e.setter, lib, p) : null;
    return ModelElement.fromPropertyInducingElement(e, lib, p,
        getter: getter, setter: setter);
  }
  return ModelElement.from(e, lib, p);
}