示例#1
0
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";
	}
}