cleanup: Avoid variable declarations in case clauses
While allowed by the syntax, they are problematic because the variable is in the scope of the switch() statement, but only valid if a particular case clause is reached. Add braces to limit the variables' scope to the corresponding case clause to avoid that problem. Spotted by eslint. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607
This commit is contained in:
parent
e2e02c9a2f
commit
d008c6c5c5
@ -679,12 +679,13 @@ var NetworkAgent = class {
|
|||||||
let connectionSetting = connection.get_setting_connection();
|
let connectionSetting = connection.get_setting_connection();
|
||||||
let connectionType = connectionSetting.get_connection_type();
|
let connectionType = connectionSetting.get_connection_type();
|
||||||
switch (connectionType) {
|
switch (connectionType) {
|
||||||
case '802-11-wireless':
|
case '802-11-wireless': {
|
||||||
let wirelessSetting = connection.get_setting_wireless();
|
let wirelessSetting = connection.get_setting_wireless();
|
||||||
let ssid = NM.utils_ssid_to_utf8(wirelessSetting.get_ssid().get_data());
|
let ssid = NM.utils_ssid_to_utf8(wirelessSetting.get_ssid().get_data());
|
||||||
title = _("Authentication required by wireless network");
|
title = _("Authentication required by wireless network");
|
||||||
body = _("Passwords or encryption keys are required to access the wireless network “%s”.").format(ssid);
|
body = _("Passwords or encryption keys are required to access the wireless network “%s”.").format(ssid);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case '802-3-ethernet':
|
case '802-3-ethernet':
|
||||||
title = _("Wired 802.1X authentication");
|
title = _("Wired 802.1X authentication");
|
||||||
body = _("A password is required to connect to “%s”.".format(connection.get_id()));
|
body = _("A password is required to connect to “%s”.".format(connection.get_id()));
|
||||||
|
@ -549,7 +549,7 @@ var Inspector = GObject.registerClass({
|
|||||||
|
|
||||||
_onScrollEvent(actor, event) {
|
_onScrollEvent(actor, event) {
|
||||||
switch (event.get_scroll_direction()) {
|
switch (event.get_scroll_direction()) {
|
||||||
case Clutter.ScrollDirection.UP:
|
case Clutter.ScrollDirection.UP: {
|
||||||
// select parent
|
// select parent
|
||||||
let parent = this._target.get_parent();
|
let parent = this._target.get_parent();
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@ -557,6 +557,7 @@ var Inspector = GObject.registerClass({
|
|||||||
this._update(event);
|
this._update(event);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case Clutter.ScrollDirection.DOWN:
|
case Clutter.ScrollDirection.DOWN:
|
||||||
// select child
|
// select child
|
||||||
|
Loading…
Reference in New Issue
Block a user