Skip to content

Commit

Permalink
#6023: Add ScriptDeclaration::isNull object to check for empty refere…
Browse files Browse the repository at this point in the history
…nces returned by findDeclaration
  • Loading branch information
codereader committed Jul 28, 2022
1 parent 475f9c2 commit 85efd45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/script/interfaces/DeclarationManagerInterface.cpp
Expand Up @@ -81,6 +81,7 @@ void DeclarationManagerInterface::registerInterface(py::module& scope, py::dict&
.def_readwrite("modName", &decl::DeclarationBlockSyntax::modName);

declaration.def(py::init<const decl::IDeclaration::Ptr&>());
declaration.def("isNull", &ScriptDeclaration::isNull);
declaration.def("getDeclName", &ScriptDeclaration::getDeclName);
declaration.def("getDeclType", &ScriptDeclaration::getDeclType);
declaration.def("getBlockSyntax", &ScriptDeclaration::getBlockSyntax);
Expand Down
5 changes: 5 additions & 0 deletions plugins/script/interfaces/DeclarationManagerInterface.h
Expand Up @@ -23,6 +23,11 @@ class ScriptDeclaration
return _decl;
}

bool isNull() const
{
return !_decl;
}

const std::string& getDeclName() const
{
static std::string _emptyName;
Expand Down

0 comments on commit 85efd45

Please sign in to comment.