X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Floader%2FParsedSource.cpp;h=c0d3a411782fea5e840b97720b2222c8d120a416;hb=ad15762dbafd23a80ac765fd5bb114640fb0264e;hp=90498e71f3e17ee5e2b96dea5d58803994851cc3;hpb=a55d4589da1a0cdec73c0bcf69a2af6bccf868cb;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); } }