buildCanonicalModelElement method

  1. @override
ModelElement buildCanonicalModelElement()
override

Implementation

@override
ModelElement buildCanonicalModelElement() {
  // TODO(jcollins-g): factor out extension logic into [Extendable]
  if (canonicalEnclosingContainer is Extension) {
    return this;
  }
  if (canonicalEnclosingContainer is Class) {
    return (canonicalEnclosingContainer as Class)
        ?.allCanonicalModelElements
        ?.firstWhere(
            (m) =>
                m.name == name && m.isPropertyAccessor == isPropertyAccessor,
            orElse: () => null);
  }
  if (canonicalEnclosingContainer != null) {
    throw UnimplementedError('$canonicalEnclosingContainer: unknown type');
  }
  return null;
}