Converts A && A.B into A?.B (#54342)

Implements the ?. operator, replacing code like A && A.B with A?.B

BYOND Ref:
When reading A?.B, it's equivalent to A && A.B except that A is only evaluated once, even if it's a complex expression like a proc call.
This commit is contained in:
ZeWaka
2020-10-13 16:43:53 -03:00
committed by GitHub
parent a92fcb5295
commit 9629feed35
214 changed files with 377 additions and 377 deletions
+1 -1
View File
@@ -186,7 +186,7 @@
for(var/obj/item/card/id/ID in src)
qdel(ID)
if(authorized && authorized.len)
if(authorized?.len)
authorized.Cut()
authorized = null
+3 -3
View File
@@ -45,7 +45,7 @@
. = ..()
GLOB.navigation_computers -= src
if(my_port && my_port.get_docked())
if(my_port?.get_docked())
my_port.delete_after = TRUE
my_port.id = null
my_port.name = "Old [my_port.name]"
@@ -154,7 +154,7 @@
return
///Make one use port that deleted after fly off, to don't lose info that need on to properly fly off.
if(my_port && my_port.get_docked())
if(my_port?.get_docked())
my_port.unregister()
my_port.delete_after = TRUE
my_port.id = null
@@ -279,7 +279,7 @@
return SHUTTLE_DOCKER_BLOCKED
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/update_hidden_docking_ports(list/remove_images, list/add_images)
if(!see_hidden && current_user && current_user.client)
if(!see_hidden && current_user?.client)
current_user.client.images -= remove_images
current_user.client.images += add_images
+5 -5
View File
@@ -188,7 +188,7 @@
/obj/docking_port/stationary/register()
if(!id)
id = "dock"
else
else
port_destinations = id
if(!name)
@@ -391,7 +391,7 @@
name = "shuttle"
var/counter = 1
var/tmp_id = id
var/tmp_name = name
var/tmp_name = name
while(Check_id(id))
counter++
id = "[tmp_id]_[counter]"
@@ -543,7 +543,7 @@
var/underlying_area_type = SHUTTLE_DEFAULT_UNDERLYING_AREA
// If the shuttle is docked to a stationary port, restore its normal
// "empty" area and turf
if(current_dock && current_dock.area_type)
if(current_dock?.area_type)
underlying_area_type = current_dock.area_type
var/list/old_turfs = return_ordered_turfs(x, y, z, dir)
@@ -691,7 +691,7 @@
for(var/place in shuttle_areas)
var/area/shuttle/shuttle_area = place
shuttle_area.parallax_movedir = FALSE
if(assigned_transit && assigned_transit.assigned_area)
if(assigned_transit?.assigned_area)
assigned_transit.assigned_area.parallax_movedir = FALSE
var/list/L0 = return_ordered_turfs(x, y, z, dir)
for (var/thing in L0)
@@ -817,7 +817,7 @@
/obj/docking_port/mobile/proc/getDbgStatusText()
var/obj/docking_port/stationary/dockedAt = get_docked()
. = (dockedAt && dockedAt.name) ? dockedAt.name : "unknown"
. = (dockedAt?.name) ? dockedAt.name : "unknown"
if(istype(dockedAt, /obj/docking_port/stationary/transit))
var/obj/docking_port/stationary/dst
if(mode == SHUTTLE_RECALL)