AST Builder. This class manages the building of an AST, including queries on the existing AST such as name and type lookups. The building operations are called by SWalker as it walks the parse tree.
Public Member functions Summary: | |
constructor | Lookup(Builder*) Constructor [Source] |
destructor | ~Lookup() Destructor. [Source] |
void | set_access(AST::Access) Changes the current accessability for the current scope [Source] |
AST::Scope* | scope() Returns the current scope [Source] |
AST::Scope* | global() Returns the global scope [Source] |
Types::Named* | lookupType(const std::string& name, bool func_okay = false) Looks up the name in the current scope. [Source] |
Types::Named* | lookupType(const ScopedName& names, bool func_okay = false, AST::Scope* scope = __null) Looks up the qualified name in the current scope. [Source] |
Types::Named* | lookupType(const std::string& name, AST::Scope* scope) Looks up the name in the scope of the given scope. [Source] |
AST::Function* | lookupFunc(const std::string&, AST::Scope*, const std::vector<Types::Type*>&) Looks up the function in the given scope with the given args. [Source] |
AST::Function* | lookupOperator(const std::string& oper, Types::Type* left_type, Types::Type* right_type) Looks up the function operator in the current scope with the given types. [Source] |
bool | mapName(const ScopedName& name, std::vector<AST::Scope*>&, Types::Named*&) Maps a scoped name into a vector of scopes and the final type. [Source] |
Types::Type* | arrayOperator(Types::Type* object, Types::Type* arg, AST::Function*&) Returns the types for an array operator on the given type with an argument of the given type. [Source] |
Types::Named* | resolveType(Types::Named* maybe_unknown) Resolves the final type of the given type. [Source] |
Private Member functions Summary: | |
Types::Named* | lookup(const std::string& name, bool func_okay = false) Looks up the name in the current scope. [Source] |
Types::Named* | lookup(const std::string& name, const ScopeSearch&, bool func_okay = false) Searches for name in the list of Scopes. [Source] |
Types::Named* | lookupQual(const std::string& name, const ScopeInfo*, bool func_okay = false) Searches for name in the given qualified scope. [Source] |
ScopeInfo* | find_info(AST::Scope*) Return a ScopeInfo* for the given Declaration. [Source] |
void | findFunctions(const std::string&, ScopeInfo*, std::vector<AST::Function*>&) Utility class to add all functions with the given name in the given Scope's dictionary to the given vector. [Source] |
AST::Function* | bestFunction(const std::vector<AST::Function*>&, const std::vector<Types::Type*>&, int& cost) Determines the best function from the given list for the given arguments using heuristics. [Source] |
std::string | dumpSearch(ScopeInfo* scope) Formats the search of the given Scope for logging [Source] |
Private Data members Summary: | |
Builder* | m_builder A pointer to the Builder. [Source] |
Public Member function Details: |
Destructor. Recursively destroys all AST objects
Looks up the name in the current scope. This method always succeeds -- if the name is not found it forward declares it.
Looks up the qualified name in the current scope. This method always succeeds -- if the name is not found it forwards declares it.
Looks up the name in the scope of the given scope. This method may return a NULL ptr if the lookup failed.
Looks up the function operator in the current scope with the given types. May return NULL if builtin operator or no operator is found.
Maps a scoped name into a vector of scopes and the final type. Returns true on success.
Returns the types for an array operator on the given type with an argument of the given type. If a function is used then it is stored in the function ptr ref given, else the ptr is set to NULL.
Resolves the final type of the given type. If the given type is an Unknown, it checks to see if the type has been defined yet and returns that instead.
Private Member function Details: |
Looks up the name in the current scope. This method may fail and return a NULL ptr.
Searches for name in the list of Scopes. This method may return NULL if the name is not found.
Searches for name in the given qualified scope. This method may return NULL if the name is not found. Lookup proceeds according to the spec: if 'scope' is a Class scope, then scope and all base classes are searched, else if it's a 'namespace' scope then all usings are checked.
Return a ScopeInfo* for the given Declaration. This method first looks for an existing Scope* in the Private map.
Utility class to add all functions with the given name in the given Scope's dictionary to the given vector. May throw an error if the types looked up are not functions.
Determines the best function from the given list for the given arguments using heuristics. Returns the function and stores the cost