[gjs: 8/11] object: Combine consecutive if-blocks




commit 5aa16cecd74a3dcf01ab575945bbf0aefd2ae53a
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Sep 28 23:24:01 2021 -0700

    object: Combine consecutive if-blocks
    
    There were two if-blocks with the same condition, and the condition was
    not modified in the body of the first block. When combining them, the code
    looks slightly odd though, so clarify why this is correct with a comment.

 gi/object.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 602a2875..3b1a1bd0 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2793,9 +2793,8 @@ bool ObjectPrototype::hook_up_vfunc_impl(JSContext* cx,
                 }
             }
         }
-    }
 
-    if (!vfunc) {
+        // Fall back to less helpful error message
         gjs_throw(cx, "Could not find definition of virtual function %s",
                   name.get());
         return false;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]