* @file
*
* This file declares the SearchSymbol utility class, which wraps the symbol-search
* queries against the ASTContext searcher used during type checking.
*/
#ifndef CANGJIE_SEMA_SEARCHSYMBOL_H
#define CANGJIE_SEMA_SEARCHSYMBOL_H
#include <vector>
#include "cangjie/AST/Searcher.h"
#include "cangjie/AST/Symbol.h"
namespace Cangjie {
class ASTContext;
* Stateless helper that issues symbol-table searches against the @p ASTContext searcher.
*
* These queries do not depend on any TypeChecker state, so they are grouped here rather
* than on the TypeChecker implementation class.
*/
class SearchSymbol {
public:
* Warmup the searcher cache for top-level scopes in parallel.
* Only effective when the host has enough cores.
*/
static void WarmupCache(const ASTContext& ctx);
static std::vector<AST::Symbol*> GetAllDecls(const ASTContext& ctx);
static std::vector<AST::Symbol*> GetGenericCandidates(const ASTContext& ctx);
static std::vector<AST::Symbol*> GetAllStructDecls(const ASTContext& ctx);
static std::vector<AST::Symbol*> GetToplevelDecls(const ASTContext& ctx);
* Get symbols of the given AST kind, ordered by @p order.
* @param order defaults to position descending.
*/
static std::vector<AST::Symbol*> GetSymsByASTKind(
const ASTContext& ctx, AST::ASTKind astKind, const Order& order = Sort::posDesc);
};
}
#endif