[gnome-boxes/wip/rishi/rhel: 3/13] wizard-source: Use 'requires' instead of 'assert'



commit 5fd82ceb7f6e3ae988a372e5089e3152233c2e62
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Aug 23 18:44:26 2017 +0200

    wizard-source: Use 'requires' instead of 'assert'
    
    It seems nicer to use 'requires' (and 'ensures') for expressing post
    and pre-conditions. It is more readable and doesn't crash hard when an
    invariant is violated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786689

 src/wizard-source.vala |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index 4f7613d..2c16ec2 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -180,9 +180,9 @@ private class Boxes.WizardSource: Gtk.Stack {
         transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT; // FIXME: Why this won't work from .ui 
file?
     }
 
-    public void setup_ui (AppWindow window, WizardWindow wizard_window) {
-        assert (window != null);
-        assert (wizard_window != null);
+    public void setup_ui (AppWindow window, WizardWindow wizard_window)
+        requires (window != null)
+        requires (wizard_window != null) {
 
         this.window = window;
         wizard = wizard_window.wizard;


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