static void addParameters(const SubscriptDecl *D, TextEntity &Ent, SourceManager &SM, unsigned BufferID) { ArrayRef<Identifier> ArgNames; DeclName Name = D->getFullName(); if (Name) { ArgNames = Name.getArgumentNames(); } addParameters(ArgNames, D->getIndices(), Ent, SM, BufferID); }
static void addParameters(const AbstractFunctionDecl *FD, TextEntity &Ent, SourceManager &SM, unsigned BufferID) { auto params = FD->getParameterLists(); // Ignore 'self'. if (FD->getDeclContext()->isTypeContext()) params = params.slice(1); ArrayRef<Identifier> ArgNames; DeclName Name = FD->getFullName(); if (Name) { ArgNames = Name.getArgumentNames(); } for (auto paramList : params) { addParameters(ArgNames, paramList, Ent, SM, BufferID); } }
int DeclName::compare(DeclName other) const { // Compare base names. if (int result = getBaseName().compare(other.getBaseName())) return result; // Compare argument names. auto argNames = getArgumentNames(); auto otherArgNames = other.getArgumentNames(); for (unsigned i = 0, n = std::min(argNames.size(), otherArgNames.size()); i != n; ++i) { if (int result = argNames[i].compare(otherArgNames[i])) return result; } if (argNames.size() == otherArgNames.size()) return 0; return argNames.size() < otherArgNames.size() ? -1 : 1; }
static void addParameters(const AbstractFunctionDecl *FD, TextEntity &Ent, SourceManager &SM, unsigned BufferID) { auto Pats = FD->getBodyParamPatterns(); // Ignore 'self'. if (FD->getDeclContext()->isTypeContext() && !Pats.empty() && isa<TypedPattern>(Pats.front())) { Pats = Pats.slice(1); } ArrayRef<Identifier> ArgNames; DeclName Name = FD->getFullName(); if (Name) { ArgNames = Name.getArgumentNames(); } for (auto Pat : Pats) { addParameters(ArgNames, Pat, Ent, SM, BufferID); } }