+ # Associate each parameter to a position in the arguments
+ var map = new SignatureMap
+
+ # Special case for the isolated last argument
+ # TODO: reify this method characteristics (where? the param, the signature, the method?)
+ var last_is_padded = mproperty.name.chars.last == '='
+ var nbargs = args.length
+ if last_is_padded then
+ nbargs -= 1
+ assert not args.last isa ANamedargExpr
+ map.map[msignature.arity - 1] = args.length - 1
+ self.visit_expr_subtype(args.last, msignature.mparameters.last.mtype)
+ end
+
+ # First, handle named arguments
+ for i in [0..args.length[ do
+ var e = args[i]
+ if not e isa ANamedargExpr then continue
+ var name = e.n_id.text
+ var param = msignature.mparameter_by_name(name)
+ if param == null then
+ modelbuilder.error(e.n_id, "Error: no parameter `{name}` for `{mproperty}{msignature}`.")
+ return null
+ end
+ var idx = msignature.mparameters.index_of(param)
+ var prev = map.map.get_or_null(idx)
+ if prev != null then
+ modelbuilder.error(e, "Error: parameter `{name}` already associated with argument #{prev} for `{mproperty}{msignature}`.")
+ return null
+ end
+ map.map[idx] = i
+ e.mtype = self.visit_expr_subtype(e.n_expr, param.mtype)
+ end
+
+ # Number of minimum mandatory remaining parameters
+ var min_arity = 0
+
+ # Second, associate remaining parameters