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 12:43:53 -07:00
committed by GitHub
parent a92fcb5295
commit 9629feed35
214 changed files with 377 additions and 377 deletions
+1 -1
View File
@@ -349,7 +349,7 @@
/obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_overlays()
. = ..()
if(reagents && reagents.total_volume)
if(reagents?.total_volume)
var/mutable_appearance/filling = mutable_appearance('icons/obj/lavaland/ash_flora.dmi', "fullbowl")
filling.color = mix_color_from_reagents(reagents.reagent_list)
. += filling
+1 -1
View File
@@ -52,7 +52,7 @@
if(O.refined_type == null)
return
if(O && O.refined_type)
if(O?.refined_type)
points += O.points * point_upgrade * O.amount
var/material_amount = mat_container.get_item_material_amount(O, BREAKDOWN_FLAGS_ORM)
+1 -1
View File
@@ -83,7 +83,7 @@
. += "<span class='boldwarning'>[t_He] look[t_s] severely dented!</span>"
. += {"<span class='notice'>Using a mining scanner on [t_him] will instruct [t_him] to drop stored ore. <b>[max(0, LAZYLEN(contents) - 1)] Stored Ore</b>\n
Field repairs can be done with a welder."}
if(stored_gun && stored_gun.max_mod_capacity)
if(stored_gun?.max_mod_capacity)
. += "<b>[stored_gun.get_remaining_mod_capacity()]%</b> mod capacity remaining."
for(var/A in stored_gun.get_modkits())
var/obj/item/borg/upgrade/modkit/M = A