diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-15 23:09:28 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-15 23:09:28 +0100 |
commit | a18012702fa6f9ff593c180112cbbc64c2ee0c41 (patch) | |
tree | 375e79969134e3d2b21c5b91fba9cadf1f9a2540 /src/core | |
parent | 988fac434d2450998cbce85e338cb1534acfa808 (diff) |
got rid of some unnecessary warnings.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/model/Domain.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
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<FieldDescriptor> 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<Descriptor>()->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); } |