* Prevent naming properties with reserved words (Fix #16846) * Prevent using reserved constant names for properties or aliases * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * App: Add unit test for isTokenAConstant --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
@@ -437,6 +437,11 @@ static bool isNamePropOk(const QString& nameProp, App::DocumentObject* obj,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ExpressionParser::isTokenAUnit(name) || ExpressionParser::isTokenAConstant(name)) {
|
||||
message << name << " is a reserved word";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto prop = obj->getPropertyByName(name.c_str());
|
||||
if (prop && prop->getContainer() == obj) {
|
||||
message << name << " already exists";
|
||||
|
||||
Reference in New Issue
Block a user