From: Jean Privat Date: Sat, 11 Apr 2015 16:55:07 +0000 (+0700) Subject: typing: remove cache in FlowContext X-Git-Tag: v0.7.4~26^2~12 X-Git-Url: http://nitlanguage.org typing: remove cache in FlowContext Because type adaptation require recomputation on loops Signed-off-by: Jean Privat --- diff --git a/src/semantize/typing.nit b/src/semantize/typing.nit index e51269f..4e446a4 100644 --- a/src/semantize/typing.nit +++ b/src/semantize/typing.nit @@ -545,7 +545,6 @@ end redef class FlowContext # Store changes of types because of type evolution private var vars = new HashMap[Variable, nullable MType] - private var cache = new HashMap[Variable, nullable Array[nullable MType]] # Adapt the variable to a static type # Warning1: do not modify vars directly. @@ -553,14 +552,10 @@ redef class FlowContext private fun set_var(variable: Variable, mtype: nullable MType) do self.vars[variable] = mtype - self.cache.keys.remove(variable) end private fun collect_types(variable: Variable): nullable Array[nullable MType] do - if cache.has_key(variable) then - return cache[variable] - end var res: nullable Array[nullable MType] = null if vars.has_key(variable) then var mtype = vars[variable] @@ -582,7 +577,6 @@ redef class FlowContext end end end - cache[variable] = res return res end end