summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp56
1 files changed, 45 insertions, 11 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 6da9c52f995..e58f65d9ec6 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -1518,18 +1518,18 @@ Slice::Container::hasNonLocalSequences() const
}
bool
-Slice::Container::hasNonLocalDictionaries() const
+Slice::Container::hasNonLocalExceptions() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- DictionaryPtr d = DictionaryPtr::dynamicCast(*p);
- if(d && !d->isLocal())
+ ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
+ if(q && !q->isLocal())
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasNonLocalDictionaries())
+ if(container && container->hasNonLocalExceptions())
{
return true;
}
@@ -1539,18 +1539,17 @@ Slice::Container::hasNonLocalDictionaries() const
}
bool
-Slice::Container::hasNonLocalExceptions() const
+Slice::Container::hasClassDecls() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- ExceptionPtr q = ExceptionPtr::dynamicCast(*p);
- if(q && !q->isLocal())
+ if(ClassDeclPtr::dynamicCast(*p))
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasNonLocalExceptions())
+ if(container && container->hasClassDecls())
{
return true;
}
@@ -1560,17 +1559,18 @@ Slice::Container::hasNonLocalExceptions() const
}
bool
-Slice::Container::hasClassDecls() const
+Slice::Container::hasDictionaries() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
- if(ClassDeclPtr::dynamicCast(*p))
+ DictionaryPtr d = DictionaryPtr::dynamicCast(*p);
+ if(d)
{
return true;
}
ContainerPtr container = ContainerPtr::dynamicCast(*p);
- if(container && container->hasClassDecls())
+ if(container && container->hasDictionaries())
{
return true;
}
@@ -1580,6 +1580,40 @@ Slice::Container::hasClassDecls() const
}
bool
+Slice::Container::hasOnlyDictionaries(DictionaryList& dicts) const
+{
+ bool ret = true;
+ for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
+ {
+ ModulePtr m = ModulePtr::dynamicCast(*p);
+ if(m)
+ {
+ bool subret = m->hasOnlyDictionaries(dicts);
+ if(!subret && ret)
+ {
+ ret = false;
+ }
+ }
+ DictionaryPtr d = DictionaryPtr::dynamicCast(*p);
+ if(d && ret)
+ {
+ dicts.push_back(d);
+ }
+ else
+ {
+ ret = false;
+ }
+ }
+
+ if(!ret)
+ {
+ dicts.clear();
+ }
+
+ return ret;
+}
+
+bool
Slice::Container::hasClassDefs() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)