+
+redef class MMExplicitImport
+ var signature : MMSignature
+
+ redef init( local_class : MMLocalClass, meth : MMMethod )
+ do
+ super
+ signature = meth.signature.adaptation_to( local_class.get_type )
+ end
+end
+
+# A closure in a signature
+class MMClosure
+ # The name of the closure (without the !)
+ readable var _name: Symbol
+
+ # The signature of the closure
+ readable var _signature: MMSignature
+
+ # Is the closure a brek one
+ # aka is defined with the break keyword thus does not return
+ readable var _is_break: Bool
+
+ # Is the closure optional?
+ # ie is there a default definition
+ readable var _is_optional: Bool
+
+ # Adapt the signature to a different receiver
+ fun adaptation_to(r: MMType): MMClosure
+ do
+ return new MMClosure(_name, _signature.adaptation_to(r), _is_break, _is_optional)
+ end
+
+ init(name: Symbol, s: MMSignature, is_break: Bool, is_optional: Bool)
+ do
+ _name = name
+ _signature = s
+ _is_break = is_break
+ _is_optional = is_optional
+ end
+
+ fun not_for_self: MMClosure
+ do
+ var sig = _signature.not_for_self
+ if sig != _signature then
+ return new MMClosure(_name, sig, _is_break, _is_optional)
+ else
+ return self
+ end
+ end
+
+ fun <(c: MMClosure): Bool
+ do
+ if c.is_optional and not is_optional then return false
+ if not c.is_break and is_break then return false
+ return c.signature < signature
+ end
+end
+