X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FParsedSource.cpp;h=c0d3a411782fea5e840b97720b2222c8d120a416;hb=d5959073b2c413ba1bd6f3d14bc8bcf59304e488;hp=90498e71f3e17ee5e2b96dea5d58803994851cc3;hpb=ba714f2fe9064dd49b4c4a387502579b38a73223;p=l2e.git diff --git a/src/loader/ParsedSource.cpp b/src/loader/ParsedSource.cpp index 90498e7..c0d3a41 100644 --- a/src/loader/ParsedSource.cpp +++ b/src/loader/ParsedSource.cpp @@ -90,7 +90,14 @@ Definition &ParsedSource::GetDefinition(const std::string &name) { if (i != definitions.end()) { return *i->second; } else { - throw runtime_error("undefined identifier " + name); + string msg("undefined identifier " + name); + map::const_iterator i(declarations.find(name)); + if (i != declarations.end()) { + msg += ", declared as " + i->second->TypeName(); + } else { + msg += ", not declared"; + } + throw runtime_error(msg); } } @@ -99,7 +106,14 @@ const Definition &ParsedSource::GetDefinition(const std::string &name) const { if (i != definitions.end()) { return *i->second; } else { - throw runtime_error("undefined identifier " + name); + string msg("undefined identifier " + name); + map::const_iterator i(declarations.find(name)); + if (i != declarations.end()) { + msg += ", declared as " + i->second->TypeName(); + } else { + msg += ", not declared"; + } + throw runtime_error(msg); } }