+ # anchor formal and virtual types
+ if mtype.need_anchor then mtype = v.anchor_to(mtype)
+
+ mtype = mtype.as_notnullable
+ self.coltype = mtype.as(MClassType)
+
+ # get methods is_ok, next, item
+ var ikdef = v.get_method(self, ittype, "is_ok", false)
+ if ikdef == null then
+ v.error(self, "Type Error: 'for' expects a method 'is_ok' in 'Iterator' type {ittype}.")
+ return
+ end
+ self.method_is_ok = ikdef
+
+ var itemdef = v.get_method(self, ittype, "item", false)
+ if itemdef == null then
+ v.error(self, "Type Error: 'for' expects a method 'item' in 'Iterator' type {ittype}.")
+ return
+ end
+ self.method_item = itemdef
+
+ var nextdef = v.get_method(self, ittype, "next", false)
+ if nextdef == null then
+ v.error(self, "Type Error: 'for' expects a method 'next' in 'Iterator' type {ittype}.")
+ return
+ end
+ self.method_next = nextdef
+
+ if is_map then
+ var keydef = v.get_method(self, ittype, "key", false)
+ if keydef == null then
+ v.error(self, "Type Error: 'for' expects a method 'key' in 'Iterator' type {ittype}.")
+ return
+ end
+ self.method_key = keydef
+ end