瀏覽代碼

Refactor: Replace `if` block w/ boolean expression

Signed-off-by: Alex Turbov <[email protected]>
Alex Turbov 4 年之前
父節點
當前提交
e3c1dbe18b
共有 1 個文件被更改,包括 2 次插入6 次删除
  1. 2 6
      Source/cmConditionEvaluator.cxx

+ 2 - 6
Source/cmConditionEvaluator.cxx

@@ -657,16 +657,12 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs,
 
 
       if (this->Policy57Status != cmPolicies::OLD &&
       if (this->Policy57Status != cmPolicies::OLD &&
           this->Policy57Status != cmPolicies::WARN) {
           this->Policy57Status != cmPolicies::WARN) {
-        auto result = false;
 
 
         def = this->GetVariableOrString(*arg);
         def = this->GetVariableOrString(*arg);
         def2 = this->Makefile.GetDefinition(argP2->GetValue());
         def2 = this->Makefile.GetDefinition(argP2->GetValue());
 
 
-        if (def2) {
-          result = cm::contains(cmExpandedList(*def2, true), *def);
-        }
-
-        HandleBinaryOp(result, arg, newArgs, argP1, argP2);
+        HandleBinaryOp(def2 && cm::contains(cmExpandedList(*def2, true), *def),
+                       arg, newArgs, argP1, argP2);
       } else if (this->Policy57Status == cmPolicies::WARN) {
       } else if (this->Policy57Status == cmPolicies::WARN) {
         std::ostringstream e;
         std::ostringstream e;
         e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0057)
         e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0057)