if (i != definitions.end()) {
return *i->second;
} else {
- throw runtime_error("undefined identifier " + name);
+ string msg("undefined identifier " + name);
+ map<string, Declaration *>::const_iterator i(declarations.find(name));
+ if (i != declarations.end()) {
+ msg += ", declared as " + i->second->TypeName();
+ } else {
+ msg += ", not declared";
+ }
+ throw runtime_error(msg);
}
}
if (i != definitions.end()) {
return *i->second;
} else {
- throw runtime_error("undefined identifier " + name);
+ string msg("undefined identifier " + name);
+ map<string, Declaration *>::const_iterator i(declarations.find(name));
+ if (i != declarations.end()) {
+ msg += ", declared as " + i->second->TypeName();
+ } else {
+ msg += ", not declared";
+ }
+ throw runtime_error(msg);
}
}