diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-05-17 11:24:18 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-05-19 20:36:51 (GMT) |
commit | c8cb66880c233414b6656ea3d23776f9ba07a4e4 (patch) | |
tree | e1fdce3ac16ba8fe58913409e1aff359a4247491 | |
parent | bdd1aa91ae28f5df7193e724b1351c616e56dc0a (diff) | |
download | CMake-c8cb66880c233414b6656ea3d23776f9ba07a4e4.zip CMake-c8cb66880c233414b6656ea3d23776f9ba07a4e4.tar.gz CMake-c8cb66880c233414b6656ea3d23776f9ba07a4e4.tar.bz2 |
cmMakefile: Use early return to reduce nested code.
-rw-r--r-- | Source/cmMakefile.cxx | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5be6b1b..21c9f47 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -110,23 +110,24 @@ public: ++it; if(it == this->VarStack.rend()) { - if(cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent()) + cmLocalGenerator* plg = mf->GetLocalGenerator()->GetParent(); + if(!plg) { - // Update the definition in the parent directory top scope. This - // directory's scope was initialized by the closure of the parent - // scope, so we do not need to localize the definition first. - cmMakefile* parent = plg->GetMakefile(); - if (varDef) - { - parent->AddDefinition(var, varDef); - } - else - { - parent->RemoveDefinition(var); - } - return true; + return false; } - return false; + // Update the definition in the parent directory top scope. This + // directory's scope was initialized by the closure of the parent + // scope, so we do not need to localize the definition first. + cmMakefile* parent = plg->GetMakefile(); + if (varDef) + { + parent->AddDefinition(var, varDef); + } + else + { + parent->RemoveDefinition(var); + } + return true; } // First localize the definition in the current scope. this->GetDefinition(var); |