findDeclaration method

DeclSite? findDeclaration(
  1. String name, {
  2. String? container,
})

The declaration named name, optionally within container.

Implementation

DeclSite? findDeclaration(String name, {String? container}) {
  DeclSite? fallback;
  for (final d in declarations) {
    if (d.name != name) continue;
    if (container != null && d.container == container) return d;
    fallback ??= d;
  }
  return fallback;
}