diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2015-05-12 10:22:23 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2015-05-12 10:22:23 -0230 |
commit | 49ade4b95b287fbc7e78afe0056e3589d5a7552a (patch) | |
tree | 03cd41e2258640a3b0a45ddb7ee74e3f9a0d3878 /cpp/src/Slice/Parser.cpp | |
parent | ICE-6503 fix setting of install prefix (diff) | |
download | ice-49ade4b95b287fbc7e78afe0056e3589d5a7552a.tar.bz2 ice-49ade4b95b287fbc7e78afe0056e3589d5a7552a.tar.xz ice-49ade4b95b287fbc7e78afe0056e3589d5a7552a.zip |
ICE-6491 duplicate error for invalid class/interface names
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index f932b73438d..36cefc9d750 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -593,6 +593,7 @@ ClassDefPtr Slice::Container::createClassDef(const string& name, int id, bool intf, const ClassList& bases, bool local) { checkIdentifier(name); + ContainedList matches = _unit->findContents(thisScope() + name); for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p) { @@ -673,16 +674,19 @@ Slice::Container::createClassDef(const string& name, int id, bool intf, const Cl // definition. This way the code generator can rely on always // having a class declaration available for lookup. // - ClassDeclPtr decl = createClassDecl(name, intf, local); + ClassDeclPtr decl = createClassDecl(name, intf, local, false); def->_declaration = decl; return def; } ClassDeclPtr -Slice::Container::createClassDecl(const string& name, bool intf, bool local) +Slice::Container::createClassDecl(const string& name, bool intf, bool local, bool checkName) { - checkIdentifier(name); + if (checkName) + { + checkIdentifier(name); + } ClassDefPtr def; @@ -2137,21 +2141,21 @@ Slice::Container::checkIntroduced(const string& scoped, ContainedPtr namedThing) // // Parameter are in its own scope. // - if((ParamDeclPtr::dynamicCast(it->second) && !ParamDeclPtr::dynamicCast(namedThing)) || + if((ParamDeclPtr::dynamicCast(it->second) && !ParamDeclPtr::dynamicCast(namedThing)) || (!ParamDeclPtr::dynamicCast(it->second) && ParamDeclPtr::dynamicCast(namedThing))) { return true; } - + // // Data members are in its own scope. // - if((DataMemberPtr::dynamicCast(it->second) && !DataMemberPtr::dynamicCast(namedThing)) || + if((DataMemberPtr::dynamicCast(it->second) && !DataMemberPtr::dynamicCast(namedThing)) || (!DataMemberPtr::dynamicCast(it->second) && DataMemberPtr::dynamicCast(namedThing))) { return true; } - + _unit->error("`" + firstComponent + "' has changed meaning"); return false; } |