summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-07-09 17:13:39 +0200
committerJose <jose@zeroc.com>2019-07-09 17:13:39 +0200
commitf0352140506800ed3a53a7fa7caca63f251bb1a4 (patch)
tree355dc0f3bb7ea8534e087474a35371140b3d0b18 /cpp/src/Slice/Parser.cpp
parentIceSSL fixes for RHEL8 (diff)
downloadice-f0352140506800ed3a53a7fa7caca63f251bb1a4.tar.bz2
ice-f0352140506800ed3a53a7fa7caca63f251bb1a4.tar.xz
ice-f0352140506800ed3a53a7fa7caca63f251bb1a4.zip
Remove forward declarations limitation - Close #97
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp112
1 files changed, 0 insertions, 112 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index e49c20f1c50..bd9d210bb47 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -6835,11 +6835,6 @@ Slice::Unit::parse(const string& filename, FILE* file, bool debug)
popContainer();
assert(_definitionContextStack.size() == 1);
popDefinitionContext();
-
- if(!checkUndefinedTypes())
- {
- status = EXIT_FAILURE;
- }
}
Slice::unit = 0;
@@ -6938,113 +6933,6 @@ Slice::Unit::eraseWhiteSpace(string& s)
}
}
-bool
-Slice::Unit::checkUndefinedTypes()
-{
- class Visitor : public ParserVisitor
- {
- public:
-
- Visitor(int& errors) :
- _errors(errors),
- _local(false)
- {
- }
-
- virtual bool visitClassDefStart(const ClassDefPtr& p)
- {
- _local = p->isLocal();
- return true;
- }
-
- virtual bool visitExceptionStart(const ExceptionPtr& p)
- {
- _local = p->isLocal();
- return true;
- }
-
- virtual bool visitStructStart(const StructPtr& p)
- {
- _local = p->isLocal();
- return true;
- }
-
- virtual void visitOperation(const OperationPtr& p)
- {
- if(p->returnType())
- {
- checkUndefined(p->returnType(), "return type", p->file(), p->line());
- }
- ParamDeclList params = p->parameters();
- for(ParamDeclList::const_iterator q = params.begin(); q != params.end(); ++q)
- {
- checkUndefined((*q)->type(), "parameter " + (*q)->name(), (*q)->file(), (*q)->line());
- }
- }
-
- virtual void visitParamDecl(const ParamDeclPtr& p)
- {
- checkUndefined(p->type(), "parameter " + p->name(), p->file(), p->line());
- }
-
- virtual void visitDataMember(const DataMemberPtr& p)
- {
- checkUndefined(p->type(), "member " + p->name(), p->file(), p->line());
- }
-
- virtual void visitSequence(const SequencePtr& p)
- {
- _local = p->isLocal();
- checkUndefined(p->type(), "element type", p->file(), p->line());
- }
-
- virtual void visitDictionary(const DictionaryPtr& p)
- {
- _local = p->isLocal();
- checkUndefined(p->keyType(), "key type", p->file(), p->line());
- checkUndefined(p->valueType(), "value type", p->file(), p->line());
- }
-
- private:
-
- void checkUndefined(const TypePtr& type, const string& desc, const string& file, const string& line)
- {
- //
- // See ICE-6867. Any use of a proxy requires the full type definition, as does any
- // use of a class in a non-local context.
- //
- ProxyPtr p = ProxyPtr::dynamicCast(type);
- if(p)
- {
- const ClassDeclPtr cl = p->_class();
- if(!cl->definition())
- {
- ostringstream ostr;
- ostr << desc << " uses a proxy for undefined type `" << cl->scoped() << "'";
- emitError(file, line, ostr.str());
- _errors++;
- }
- }
-
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl && !cl->definition() && !_local)
- {
- ostringstream ostr;
- ostr << desc << " refers to undefined type `" << cl->scoped() << "'";
- emitError(file, line, ostr.str());
- _errors++;
- }
- }
-
- int& _errors;
- bool _local;
- };
-
- Visitor v(_errors);
- visit(&v, true);
- return _errors == 0;
-}
-
// ----------------------------------------------------------------------
// CICompare
// ----------------------------------------------------------------------