[vala/0.48] codegen: Reduce get_delegate_target/get_delegate_target_destroy_notify calls



commit 5d691e8ca3ed9f8177db2c5921657dda7f843dd1
Author: Jeremy Philippe <jeremy philippe gmail com>
Date:   Wed Oct 7 13:41:40 2020 +0200

    codegen: Reduce get_delegate_target/get_delegate_target_destroy_notify calls

 codegen/valaccodebasemodule.vala | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 145d70cdd..8461ceffb 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -5362,13 +5362,15 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                set_cvalue (expr, new CCodeCastExpression (innercexpr, get_ccode_name (expr.type_reference)));
 
                if (expr.type_reference is DelegateType) {
-                       if (get_delegate_target (expr.inner) != null) {
-                               set_delegate_target (expr, get_delegate_target (expr.inner));
+                       var target = get_delegate_target (expr.inner);
+                       if (target != null) {
+                               set_delegate_target (expr, target);
                        } else {
                                set_delegate_target (expr, new CCodeConstant ("NULL"));
                        }
-                       if (get_delegate_target_destroy_notify (expr.inner) != null) {
-                               set_delegate_target_destroy_notify (expr, get_delegate_target_destroy_notify 
(expr.inner));
+                       var target_destroy_notify = get_delegate_target_destroy_notify (expr.inner);
+                       if (target_destroy_notify != null) {
+                               set_delegate_target_destroy_notify (expr, target_destroy_notify);
                        } else {
                                set_delegate_target_destroy_notify (expr, new CCodeConstant ("NULL"));
                        }


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