From a6ac98a48d54d9f2905ec080f0bb39c9576a4f1c Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 16 Apr 2014 13:28:13 -0400 Subject: [PATCH] rta: do not try to remove things from a set in iteration Instead, register the things to remove then remove them once the iteration is over, Signed-off-by: Jean Privat --- src/rapid_type_analysis.nit | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rapid_type_analysis.nit b/src/rapid_type_analysis.nit index 4916889..a40ca22 100644 --- a/src/rapid_type_analysis.nit +++ b/src/rapid_type_analysis.nit @@ -164,6 +164,9 @@ class RapidTypeAnalysis # Methods that are still candidate to the try_send private var totry_methods = new HashSet[MMethod] + # Methods that are are no more candidate to the try_send + private var totry_methods_to_remove = new Array[MMethod] + # Methods that are or were candidate to the try_send # Used to ensure that try_send is only used once private var try_methods = new HashSet[MMethod] @@ -330,6 +333,10 @@ class RapidTypeAnalysis for p in totry_methods do try_send(mtype, p) for p in live_super_sends do try_super_send(mtype, p) + # Remove cleared ones + for p in totry_methods_to_remove do totry_methods.remove(p) + totry_methods_to_remove.clear + var bound_mtype = mtype.anchor_to(mainmodule, recv) for cd in bound_mtype.collect_mclassdefs(mainmodule) do @@ -378,7 +385,7 @@ class RapidTypeAnalysis if not live_methoddefs.has(d) then return end #print "full property: {mpropdef.mproperty} for {mpropdef.mproperty.mpropdefs.length} definitions" - totry_methods.remove(mpropdef.mproperty) + totry_methods_to_remove.add(mpropdef.mproperty) end fun add_send(recv: MType, mproperty: MMethod) -- 1.7.9.5