Patrick R. Michaud wrote:
With the new PIR calling conventions, emit() is to be written
with ":optional" on the optional parameters, like so:
.sub "emit" method
.param pmc code # accumulating code object
.param string out # string to output
.param string str1 :optional # first %s substitution
.param string str2 :optional # second %s substitution
.param string str3 :optional # third %s substitution
.param int int1 :optional # first %d substitution
# ...
That's fine, but under the new calling conventions the original
calls to emit() no longer work
To me it seems, however you declare the "emit" function (with mixed
optional native types), it either isn't following the principle of
strict positional argument passing, or it does the wrong thing due to
type conversions.
emit(P, S, S, I, S) # int1 passed out of order Exp.pir:534 /backref
emit(P, S, I, S) # a lot of code e.g. min, label
emit(P, S, S, S) # Exp.pir:701 /charmatch, label
The only sane way seems to be to define emit as
emit(code, out, ?str1, ?str2, ?str3, ?str4)
and do the substitutions just in order, i.e. treat %d and %s the same.
An integer argument will be converted to a string (which is good, as you
need one for the substr anyway.
Pm
leo