diff options
author | Mark Spruiell <mes@zeroc.com> | 2014-03-19 12:45:55 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2014-03-19 12:45:55 -0700 |
commit | cdcffbcc3c3c052afdeb772ff0167e7a90b525bb (patch) | |
tree | 4f16ee41ef7d33394c44e9db81e4d6cd89908250 /cpp/src/Slice/Parser.cpp | |
parent | fixing testicedist.py for 5487 (diff) | |
download | ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.tar.bz2 ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.tar.xz ice-cdcffbcc3c3c052afdeb772ff0167e7a90b525bb.zip |
merging javascript branch
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index abdffefb7e1..aedac4d3070 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1,6 +1,6 @@ // ********************************************************************** // -// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved. +// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. @@ -544,6 +544,11 @@ Slice::Container::createModule(const string& name) ContainedList matches = _unit->findContents(thisScope() + name); matches.sort(); // Modules can occur many times... matches.unique(); // ... but we only want one instance of each. + + if(thisScope() == "::") + { + _unit->addTopLevelModule(_unit->currentFile(), name); + } for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p) { @@ -1643,6 +1648,8 @@ Slice::Container::hasNonLocalExceptions() const return false; } + + bool Slice::Container::hasClassDecls() const { @@ -1739,6 +1746,28 @@ Slice::Container::hasClassDefs() const } bool +Slice::Container::hasOnlyClassDecls() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ModulePtr m = ModulePtr::dynamicCast(*p); + if(m) + { + if(!m->hasOnlyClassDecls()) + { + return false; + } + } + else if(!ClassDeclPtr::dynamicCast(*p)) + { + return false; + } + } + + return true; +} + +bool Slice::Container::hasAbstractClassDefs() const { for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) @@ -6171,6 +6200,35 @@ Slice::Unit::builtin(Builtin::Kind kind) return builtin; } +void +Slice::Unit::addTopLevelModule(const string& file, const string& module) +{ + map<string, set<string> >::iterator i = _fileTopLevelModules.find(file); + if(i == _fileTopLevelModules.end()) + { + set<string> modules; + modules.insert(module); + _fileTopLevelModules.insert(make_pair(file, modules)); + } + else + { + i->second.insert(module); + } +} +set<string> +Slice::Unit::getTopLevelModules(const string& file) const +{ + map<string, set<string> >::const_iterator i = _fileTopLevelModules.find(file); + if(i == _fileTopLevelModules.end()) + { + return set<string>(); + } + else + { + return i->second; + } +} + Slice::Unit::Unit(bool ignRedefs, bool all, bool allowIcePrefix, bool allowUnderscore, const StringList& defaultGlobalMetadata) : SyntaxTreeBase(0), |