From a18012702fa6f9ff593c180112cbbc64c2ee0c41 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Sun, 15 Feb 2015 23:09:28 +0100 Subject: got rid of some unnecessary warnings. --- src/core/model/Domain.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/core') diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp index 8bacdb8..ac0699e 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Domain.cpp @@ -569,17 +569,22 @@ void Descriptor::addAndSortFieldDescriptor(Handle fd, if (!fds.empty() && fds.back()->getFieldType() == FieldDescriptor::FieldType::TREE && fd->getFieldType() != FieldDescriptor::FieldType::TREE) { - // if so we add the new field before the TREE field and log a - // warning. - - logger.warning( - std::string("Field \"") + fd->getName() + - "\" was declared after main field \"" + - fds.back()->getName() + - "\". The order of fields was changed to make the " - "main field the last field.", - *fd); + // if so we add the new field before the TREE field. fieldDescriptors.insert(fieldDescriptors.end() - 1, fd); + + // if the new field was from the same domain we warn the user + // because that is bad coding style. + if (fd->getParent() != nullptr && + fd->getParent().cast()->getParent() == + getParent()) { + logger.warning( + std::string("Field \"") + fd->getName() + + "\" was declared after main field \"" + + fds.back()->getName() + + "\". The order of fields was changed to make the " + "main field the last field.", + *fd); + } } else { fieldDescriptors.push_back(fd); } -- cgit v1.2.3