summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-07-09 17:28:56 +0200
committerJose <jose@zeroc.com>2019-07-09 17:28:56 +0200
commit9bb1f40c2149edadcfc24892635b1f36d649cc6f (patch)
treeb7bf38fb444a3a4a1eef23bb998ec065953f5ff3 /cpp/src/Slice/Parser.cpp
parentFix ice.xcodeproj path issue (diff)
parentRemove forward declarations limitation - Close #97 (diff)
downloadice-9bb1f40c2149edadcfc24892635b1f36d649cc6f.tar.bz2
ice-9bb1f40c2149edadcfc24892635b1f36d649cc6f.tar.xz
ice-9bb1f40c2149edadcfc24892635b1f36d649cc6f.zip
Merge remote-tracking branch 'origin/3.7' into swift
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 e0ed44f449e..7e0149b602b 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -6896,11 +6896,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;
@@ -6999,113 +6994,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
// ----------------------------------------------------------------------