void SemanticsVisitor::visit(Identifier& id) { id.setType(0); // init to error type. NOTICE by design, null attribute and error type is 0. try { Attributes* attributeRef = currentSymbolTable().retrieveSymbol(id.name()); if (isDataObject(attributeRef)) { id.setAttributes(attributeRef); } else { errorLog() << id.name() << " does not name a data object.\n"; } } catch (std::runtime_error& e) { errorLog() << id.name() << " has not been declared.\n"; } }
bool ASTPrinter::visit(Identifier const& _node) { writeLine(string("Identifier ") + _node.name()); printType(_node); printSourcePart(_node); return goDeeper(); }
bool ReferencesResolver::visit(Identifier const& _identifier) { auto declarations = m_resolver.nameFromCurrentScope(_identifier.name()); if (declarations.empty()) fatalDeclarationError(_identifier.location(), "Undeclared identifier."); else if (declarations.size() == 1) _identifier.annotation().referencedDeclaration = declarations.front(); else _identifier.annotation().overloadedDeclarations = m_resolver.cleanedDeclarations(_identifier, declarations); return false; }
std::string tesla::ShortName(const Identifier& ID) { if (ID.has_name()) return ID.name(); return ShortName(ID.location()); }
uint qHash(const Identifier& identifier) { return qHash(identifier.name().toLower()); }
bool Identifier::operator<(const Identifier& other) const { return mName.toLower() < other.name().toLower(); }