[gnome-shell/wip/fmuellner/minor-bug-fixes: 6/9] ibusCandidatePopup: Clarify assignment in condition



commit 69286bf1d3d5dfc9d260c3758f525270d582d4d2
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jan 29 22:56:03 2019 +0100

    ibusCandidatePopup: Clarify assignment in condition
    
    Most often it is a bug if the condition part of a for-loop contains the
    assignment operator rather than the comparison one, so tools rightfully
    emit a warning.
    
    Clarify that the assignment is intentional in this case by adding
    parentheses.
    
    Spotted by eslint.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/375

 js/ui/ibusCandidatePopup.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js
index 124426887..5bea99824 100644
--- a/js/ui/ibusCandidatePopup.js
+++ b/js/ui/ibusCandidatePopup.js
@@ -236,7 +236,7 @@ var CandidatePopup = class CandidatePopup {
 
             let indexes = [];
             let indexLabel;
-            for (let i = 0; indexLabel = lookupTable.get_label(i); ++i)
+            for (let i = 0; (indexLabel = lookupTable.get_label(i)); ++i)
                  indexes.push(indexLabel.get_text());
 
             Main.keyboard.resetSuggestions();
@@ -295,7 +295,7 @@ var CandidatePopup = class CandidatePopup {
 
     _setTextAttributes(clutterText, ibusAttrList) {
         let attr;
-        for (let i = 0; attr = ibusAttrList.get(i); ++i)
+        for (let i = 0; (attr = ibusAttrList.get(i)); ++i)
             if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
                 clutterText.set_selection(attr.get_start_index(), attr.get_end_index());
     }


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