func contains()

in SwiftEvolve/Sources/SwiftEvolve/DeclContext.swift [469:481]


  func contains(named name: String) -> Bool {
    return self?.contains { 
      if let builtinAttribute = $0.as(AttributeSyntax.self) {
        return builtinAttribute.attributeName.text == name 
      } else if let customAttribute = $0.as(CustomAttributeSyntax.self) {
        // FIXME: Attribute name is a TypeSyntax, so .description isn't quite
        // right here (e.g. @MyCustomAttribute<MyTypeParam> is valid)
        return customAttribute.attributeName.description == name
      } else {
        preconditionFailure("unhandled AttributeListSyntax element kind")
      }
    } ?? false
  }