From aefd61c3db6056063ada1cb58bf67b088cc59ff0 Mon Sep 17 00:00:00 2001
From: Philip Chimento <philip@endlessm.com>
Date: Thu, 9 Feb 2017 18:12:59 -0800
Subject: [PATCH] js: Avoid double declarations with let

The following code is a syntax error in ES6:

    let a = 'something';
    let a = 'other thing';

Previously GJS would silently accept this code, but in the next release the
SpiderMonkey JS engine will be more ES6-compliant.

https://bugzilla.gnome.org/show_bug.cgi?id=778425
---
 js/misc/keyboardManager.js  | 3 ++-
 js/ui/dateMenu.js           | 2 +-
 js/ui/endSessionDialog.js   | 1 -
 js/ui/notificationDaemon.js | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/js/misc/keyboardManager.js b/js/misc/keyboardManager.js
index e8a3e781e..95afb4a8c 100644
--- a/js/misc/keyboardManager.js
+++ b/js/misc/keyboardManager.js
@@ -128,7 +128,8 @@ const KeyboardManager = new Lang.Class({
         if (!found)
             [, , id] = GnomeDesktop.get_input_source_from_locale(DEFAULT_LOCALE);
 
-        let [found, , , _layout, _variant] = this._xkbInfo.get_layout_info(id);
+        let _layout, _variant;
+        [found, , , _layout, _variant] = this._xkbInfo.get_layout_info(id);
         if (found)
             return { layout: _layout, variant: _variant };
         else
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 98c4aa4c3..36c795046 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -77,7 +77,7 @@ const TodayButton = new Lang.Class({
          * below the time in the shell; it should combine the weekday and the
          * date, e.g. "Tuesday February 17 2015".
          */
-        let dateFormat = Shell.util_translate_time_string (N_("%A %B %e %Y"));
+        dateFormat = Shell.util_translate_time_string (N_("%A %B %e %Y"));
         this.actor.accessible_name = date.toLocaleFormat(dateFormat);
     }
 });
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 2ec8e04e1..42977d394 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -457,7 +457,6 @@ const EndSessionDialog = new Lang.Class({
         _setLabelText(this._descriptionLabel, description);
         _setLabelText(this._subjectLabel, subject);
 
-        let dialogContent = DialogContent[this._type];
         if (dialogContent.iconName) {
             this._iconBin.child = new St.Icon({ icon_name: dialogContent.iconName,
                                                 icon_size: _DIALOG_ICON_SIZE,
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 24c82b35f..623a10fed 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -186,7 +186,7 @@ const FdoNotificationDaemon = new Lang.Class({
             return source;
         }
 
-        let source = new FdoNotificationDaemonSource(title, pid, sender, ndata ? ndata.hints['desktop-entry'] : null);
+        source = new FdoNotificationDaemonSource(title, pid, sender, ndata ? ndata.hints['desktop-entry'] : null);
 
         this._sources.push(source);
         source.connect('destroy', Lang.bind(this, function() {