# Provides a better API but mainly the same content as AExternCalls
class ForeignCallbackSet
# set of imported functions, cached to avoid repetitions
var callbacks: Set[ MExplicitCall ] = new HashSet[ MExplicitCall ]
# set of imported functions, cached to avoid repetitions
var supers: Set[ MExplicitSuper ] = new HashSet[ MExplicitSuper ]
# set of relevant types, cached to avoid repetitions
var types: Set[ MType ] = new HashSet[ MType ]
# set of imported casts and as, cached to avoid repetitions
var casts: Set[ MExplicitCast ] = new HashSet[ MExplicitCast ]
# Utility function, must be called only when all other maps are filled
private var all_cached: nullable Set[NitniCallback] = null
fun all: Set[NitniCallback]
do
var cached = all_cached
if cached != null then return cached
var set = new HashSet[NitniCallback]
set.add_all(callbacks)
set.add_all(supers)
set.add_all(types)
set.add_all(casts)
self.all_cached = set
return set
end
# Integrate content from the `other` set into this one
fun join(other: ForeignCallbackSet)
do
callbacks.add_all( other.callbacks )
supers.add_all( other.supers )
types.add_all( other.types )
casts.add_all( other.casts )
end
end
src/nitni/nitni_callbacks.nit:45,1--84,3