FLAG_DEFAULT_ARGS = 0x04,
FLAG_CHECK_NARGS = 0x08,
FLAG_INVOCANT = 0x10,
- FLAG_NAMED_PARAMS = 0x20
+ FLAG_NAMED_PARAMS = 0x20,
+ FLAG_TYPES_OK = 0x40,
+ FLAG_CHECK_TARGS = 0x80
};
DEFSTRUCT(KWSpec) {
}
-static void free_ptr_op(pTHX_ void *vp) {
+static void free_ptr_op_void(pTHX_ void *vp) {
OP **pp = vp;
op_free(*pp);
Safefree(pp);
}
+static void free_op_void(pTHX_ void *vp) {
+ OP *p = vp;
+ op_free(p);
+}
+
#define sv_eq_pvs(SV, S) my_sv_eq_pvn(aTHX_ SV, "" S "", sizeof (S) - 1)
static int my_sv_eq_pvn(pTHX_ SV *sv, const char *p, STRLEN n) {
}
}
+static SV *parse_type(pTHX_ Sentinel, const SV *);
+
+static SV *parse_type_paramd(pTHX_ Sentinel sen, const SV *declarator) {
+ I32 c;
+ SV *t;
+
+ t = my_scan_word(aTHX_ sen, TRUE);
+ lex_read_space(0);
+
+ c = lex_peek_unichar(0);
+ if (c == '[') {
+ SV *u;
+
+ lex_read_unichar(0);
+ lex_read_space(0);
+ my_sv_cat_c(aTHX_ t, c);
+
+ u = parse_type(aTHX_ sen, declarator);
+ sv_catsv(t, u);
+
+ c = lex_peek_unichar(0);
+ if (c != ']') {
+ croak("In %"SVf": missing ']' after '%"SVf"'", SVfARG(declarator), SVfARG(t));
+ }
+ lex_read_unichar(0);
+ lex_read_space(0);
+
+ my_sv_cat_c(aTHX_ t, c);
+ }
+
+ return t;
+}
+
+static SV *parse_type(pTHX_ Sentinel sen, const SV *declarator) {
+ I32 c;
+ SV *t;
+
+ t = parse_type_paramd(aTHX_ sen, declarator);
+
+ c = lex_peek_unichar(0);
+ while (c == '|') {
+ SV *u;
+
+ lex_read_unichar(0);
+ lex_read_space(0);
+
+ my_sv_cat_c(aTHX_ t, c);
+ u = parse_type_paramd(aTHX_ sen, declarator);
+ sv_catsv(t, u);
+
+ c = lex_peek_unichar(0);
+ }
+
+ return t;
+}
+
+static SV *reify_type(pTHX_ Sentinel sen, const SV *declarator, SV *name) {
+ SV *t;
+ int n;
+ dSP;
+
+ ENTER;
+ SAVETMPS;
+
+ PUSHMARK(SP);
+ EXTEND(SP, 1);
+ PUSHs(name);
+ PUTBACK;
+
+ n = call_pv("Moose::Util::TypeConstraints::find_or_parse_type_constraint", G_SCALAR);
+ SPAGAIN;
+
+ assert(n == 1);
+ t = sentinel_mortalize(sen, SvREFCNT_inc(POPs));
+
+ PUTBACK;
+ FREETMPS;
+ LEAVE;
+
+ if (!SvTRUE(t)) {
+ croak("In %"SVf": undefined type '%"SVf"'", SVfARG(declarator), SVfARG(name));
+ }
+
+ return t;
+}
+
DEFSTRUCT(Param) {
SV *name;
PADOFFSET padoff;
+ SV *type;
};
DEFSTRUCT(ParamInit) {
static void p_init(Param *p) {
p->name = NULL;
p->padoff = NOT_IN_PAD;
+ p->type = NULL;
}
static void ps_init(ParamSpec *ps) {
static void p_clear(pTHX_ Param *p) {
p->name = NULL;
p->padoff = NOT_IN_PAD;
+ p->type = NULL;
}
static void pi_clear(pTHX_ ParamInit *pi) {
return ps->named_required.used + ps->named_optional.used;
}
+static void my_require(pTHX_ const char *file) {
+ require_pv(file);
+ if (SvTRUE(ERRSV)) {
+ croak_sv(ERRSV);
+ }
+}
+
+static SV *my_eval(pTHX_ Sentinel sen, I32 floor, OP *op) {
+ SV *sv;
+ CV *cv;
+ dSP;
+
+ cv = newATTRSUB(floor, NULL, NULL, NULL, op);
+
+ ENTER;
+ SAVETMPS;
+
+ PUSHMARK(SP);
+ call_sv((SV *)cv, G_SCALAR | G_NOARGS);
+ SPAGAIN;
+ sv = sentinel_mortalize(sen, SvREFCNT_inc(POPs));
+
+ PUTBACK;
+ FREETMPS;
+ LEAVE;
+
+ return sv;
+}
+
enum {
PARAM_INVOCANT = 0x01,
PARAM_NAMED = 0x02
pTHX_
Sentinel sen,
const SV *declarator, const KWSpec *spec, ParamSpec *param_spec,
- int *pflags, SV **pname, OP **pinit
+ int *pflags, SV **pname, OP **pinit, SV **ptype
) {
I32 c;
char sigil;
- SV *name;
+ SV *name, *typeobj, *typename;
assert(!*pinit);
*pflags = 0;
+ *ptype = NULL;
c = lex_peek_unichar(0);
+ if (spec->flags & FLAG_TYPES_OK) {
+ if (c == '(') {
+ I32 floor;
+ OP *expr;
+
+ lex_read_unichar(0);
+
+ floor = start_subparse(FALSE, CVf_ANON);
+
+ if (!(expr = parse_fullexpr(PARSE_OPTIONAL))) {
+ croak("In %"SVf": invalid type expression", SVfARG(declarator));
+ }
+ sentinel_register(sen, expr, free_op_void);
+
+ lex_read_space(0);
+ c = lex_peek_unichar(0);
+ if (c != ')') {
+ croak("In %"SVf": missing ')' after type expression", SVfARG(declarator));
+ }
+ lex_read_unichar(0);
+ lex_read_space(0);
+
+ *ptype = my_eval(aTHX_ sen, floor, expr);
+ if (!sv_isobject(*ptype)) {
+ croak("In %"SVf": (%"SVf") doesn't look like a type object", SVfARG(declarator), SVfARG(*ptype));
+ }
+
+ c = lex_peek_unichar(0);
+ } else if (my_is_uni_xidfirst(aTHX_ c)) {
+ typename = parse_type(aTHX_ sen, declarator);
+ my_require(aTHX_ "Moose/Util/TypeConstraints.pm");
+ typeobj = reify_type(aTHX_ sen, declarator, typename);
+ *ptype = typeobj;
+
+ c = lex_peek_unichar(0);
+ }
+ }
+
if (c == ':') {
lex_read_unichar(0);
lex_read_space(0);
if (c == -1) {
croak("In %"SVf": unterminated parameter list", SVfARG(declarator));
}
+
if (!(c == '$' || c == '@' || c == '%')) {
croak("In %"SVf": unexpected '%c' in parameter list (expecting a sigil)", SVfARG(declarator), (int)c);
}
#define mkconstpvs(S) mkconstpv(aTHX_ "" S "", sizeof S - 1)
+static OP *mktypecheck(pTHX_ const SV *declarator, int nr, SV *name, PADOFFSET padoff, SV *type) {
+ /* $type->check($value) or Carp::croak "...: " . $type->get_message($value) */
+ OP *chk, *cond, *err, *msg, *xcroak;
+
+ err = mkconstsv(aTHX_ newSVpvf("In %"SVf": parameter %d (%"SVf"): ", SVfARG(declarator), nr, SVfARG(name)));
+ {
+ OP *args = NULL;
+
+ args = op_append_elem(OP_LIST, args, mkconstsv(aTHX_ SvREFCNT_inc_simple_NN(type)));
+ args = op_append_elem(
+ OP_LIST, args,
+ padoff == NOT_IN_PAD
+ ? S_newDEFSVOP(aTHX)
+ : my_var(aTHX_ 0, padoff)
+ );
+ args = op_append_elem(OP_LIST, args, newUNOP(OP_METHOD, 0, mkconstpvs("get_message")));
+
+ msg = args;
+ msg->op_type = OP_ENTERSUB;
+ msg->op_ppaddr = PL_ppaddr[OP_ENTERSUB];
+ msg->op_flags |= OPf_STACKED;
+ }
+
+ msg = newBINOP(OP_CONCAT, 0, err, msg);
+
+ xcroak = newCVREF(
+ OPf_WANT_SCALAR,
+ newGVOP(OP_GV, 0, gv_fetchpvs("Carp::croak", 0, SVt_PVCV))
+ );
+ xcroak = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, msg, xcroak));
+
+ {
+ OP *args = NULL;
+
+ args = op_append_elem(OP_LIST, args, mkconstsv(aTHX_ SvREFCNT_inc_simple_NN(type)));
+ args = op_append_elem(
+ OP_LIST, args,
+ padoff == NOT_IN_PAD
+ ? S_newDEFSVOP(aTHX)
+ : my_var(aTHX_ 0, padoff)
+ );
+ args = op_append_elem(OP_LIST, args, newUNOP(OP_METHOD, 0, mkconstpvs("check")));
+
+ chk = args;
+ chk->op_type = OP_ENTERSUB;
+ chk->op_ppaddr = PL_ppaddr[OP_ENTERSUB];
+ chk->op_flags |= OPf_STACKED;
+ }
+
+ chk = newLOGOP(OP_OR, 0, chk, xcroak);
+ return chk;
+}
+
+static OP *mktypecheckp(pTHX_ const SV *declarator, int nr, const Param *param) {
+ return mktypecheck(aTHX_ declarator, nr, param->name, param->padoff, param->type);
+}
+
static void register_info(pTHX_ UV key, SV *declarator, const KWSpec *kws, const ParamSpec *ps) {
dSP;
SAVETMPS;
PUSHMARK(SP);
- EXTEND(SP, 8);
+ EXTEND(SP, 10);
/* 0 */ {
mPUSHu(key);
} else {
PUSHmortal;
}
+ PUSHmortal;
mPUSHs(newRV_noinc((SV *)newAV()));
mPUSHs(newRV_noinc((SV *)newAV()));
mPUSHs(newRV_noinc((SV *)newAV()));
mPUSHs(newRV_noinc((SV *)newAV()));
mPUSHp("@_", 2);
+ PUSHmortal;
} else {
- /* 2 */ {
+ /* 2, 3 */ {
if (ps->invocant.name) {
PUSHs(ps->invocant.name);
+ if (ps->invocant.type) {
+ PUSHs(ps->invocant.type);
+ } else {
+ PUSHmortal;
+ }
} else {
PUSHmortal;
+ PUSHmortal;
}
}
- /* 3 */ {
+ /* 4 */ {
size_t i, lim;
AV *av;
av = newAV();
if (lim) {
- av_extend(av, lim - 1);
+ av_extend(av, (lim - 1) * 2);
for (i = 0; i < lim; i++) {
- av_push(av, SvREFCNT_inc_simple_NN(ps->positional_required.data[i].name));
+ Param *cur = &ps->positional_required.data[i];
+ av_push(av, SvREFCNT_inc_simple_NN(cur->name));
+ av_push(av, cur->type ? SvREFCNT_inc_simple_NN(cur->type) : &PL_sv_undef);
}
}
mPUSHs(newRV_noinc((SV *)av));
}
- /* 4 */ {
+ /* 5 */ {
size_t i, lim;
AV *av;
av = newAV();
if (lim) {
- av_extend(av, lim - 1);
+ av_extend(av, (lim - 1) * 2);
for (i = 0; i < lim; i++) {
- av_push(av, SvREFCNT_inc_simple_NN(ps->positional_optional.data[i].param.name));
+ Param *cur = &ps->positional_optional.data[i].param;
+ av_push(av, SvREFCNT_inc_simple_NN(cur->name));
+ av_push(av, cur->type ? SvREFCNT_inc_simple_NN(cur->type) : &PL_sv_undef);
}
}
mPUSHs(newRV_noinc((SV *)av));
}
- /* 5 */ {
+ /* 6 */ {
size_t i, lim;
AV *av;
av = newAV();
if (lim) {
- av_extend(av, lim - 1);
+ av_extend(av, (lim - 1) * 2);
for (i = 0; i < lim; i++) {
- av_push(av, SvREFCNT_inc_simple_NN(ps->named_required.data[i].name));
+ Param *cur = &ps->named_required.data[i];
+ av_push(av, SvREFCNT_inc_simple_NN(cur->name));
+ av_push(av, cur->type ? SvREFCNT_inc_simple_NN(cur->type) : &PL_sv_undef);
}
}
mPUSHs(newRV_noinc((SV *)av));
}
- /* 6 */ {
+ /* 7 */ {
size_t i, lim;
AV *av;
av = newAV();
if (lim) {
- av_extend(av, lim - 1);
+ av_extend(av, (lim - 1) * 2);
for (i = 0; i < lim; i++) {
- av_push(av, SvREFCNT_inc_simple_NN(ps->named_optional.data[i].param.name));
+ Param *cur = &ps->named_optional.data[i].param;
+ av_push(av, SvREFCNT_inc_simple_NN(cur->name));
+ av_push(av, cur->type ? SvREFCNT_inc_simple_NN(cur->type) : &PL_sv_undef);
}
}
mPUSHs(newRV_noinc((SV *)av));
}
- /* 7 */ {
+ /* 8, 9 */ {
if (ps->slurpy.name) {
PUSHs(ps->slurpy.name);
+ if (ps->slurpy.type) {
+ PUSHs(ps->slurpy.type);
+ } else {
+ PUSHmortal;
+ }
} else {
PUSHmortal;
+ PUSHmortal;
}
}
}
/* initialize synthetic optree */
Newx(prelude_sentinel, 1, OP *);
*prelude_sentinel = NULL;
- sentinel_register(sen, prelude_sentinel, free_ptr_op);
+ sentinel_register(sen, prelude_sentinel, free_ptr_op_void);
/* parameters */
param_spec = NULL;
Newx(init_sentinel, 1, OP *);
*init_sentinel = NULL;
- sentinel_register(sen, init_sentinel, free_ptr_op);
+ sentinel_register(sen, init_sentinel, free_ptr_op_void);
Newx(param_spec, 1, ParamSpec);
ps_init(param_spec);
while ((c = lex_peek_unichar(0)) != ')') {
int flags;
- SV *name;
+ SV *name, *type;
char sigil;
PADOFFSET padoff;
- padoff = parse_param(aTHX_ sen, declarator, spec, param_spec, &flags, &name, init_sentinel);
+ padoff = parse_param(aTHX_ sen, declarator, spec, param_spec, &flags, &name, init_sentinel, &type);
S_intro_my(aTHX);
assert(!*init_sentinel);
param_spec->slurpy.name = name;
param_spec->slurpy.padoff = padoff;
+ param_spec->slurpy.type = type;
continue;
}
}
param_spec->invocant.name = name;
param_spec->invocant.padoff = padoff;
+ param_spec->invocant.type = type;
continue;
}
ParamInit *pi = piv_extend(¶m_spec->named_optional);
pi->param.name = name;
pi->param.padoff = padoff;
+ pi->param.type = type;
pi->init = *init_sentinel;
*init_sentinel = NULL;
param_spec->named_optional.used++;
Param *p = pv_extend(¶m_spec->named_required);
p->name = name;
p->padoff = padoff;
+ p->type = type;
param_spec->named_required.used++;
}
} else {
ParamInit *pi = piv_extend(¶m_spec->positional_optional);
pi->param.name = name;
pi->param.padoff = padoff;
+ pi->param.type = type;
pi->init = *init_sentinel;
*init_sentinel = NULL;
param_spec->positional_optional.used++;
Param *p = pv_extend(¶m_spec->positional_required);
p->name = name;
p->padoff = padoff;
+ p->type = type;
param_spec->positional_required.used++;
}
}
/* attributes */
Newx(attrs_sentinel, 1, OP *);
*attrs_sentinel = NULL;
- sentinel_register(sen, attrs_sentinel, free_ptr_op);
+ sentinel_register(sen, attrs_sentinel, free_ptr_op_void);
if (c == ':' || c == '{') /* '}' - hi, vim */ {
amin = args_min(aTHX_ param_spec, spec);
if (amin > 0) {
- OP *chk, *cond, *err, *croak;
+ OP *chk, *cond, *err, *xcroak;
err = mkconstsv(aTHX_ newSVpvf("Not enough arguments for %"SVf" (expected %d, got ", SVfARG(declarator), amin));
err = newBINOP(
mkconstpvs(")")
);
- croak = newCVREF(OPf_WANT_SCALAR,
- newGVOP(OP_GV, 0, gv_fetchpvs("Carp::croak", 0, SVt_PVCV)));
+ xcroak = newCVREF(OPf_WANT_SCALAR,
+ newGVOP(OP_GV, 0, gv_fetchpvs("Carp::croak", 0, SVt_PVCV)));
err = newUNOP(OP_ENTERSUB, OPf_STACKED,
- op_append_elem(OP_LIST, err, croak));
+ op_append_elem(OP_LIST, err, xcroak));
cond = newBINOP(OP_LT, 0,
newAVREF(newGVOP(OP_GV, 0, PL_defgv)),
amax = args_max(param_spec);
if (amax >= 0) {
- OP *chk, *cond, *err, *croak;
+ OP *chk, *cond, *err, *xcroak;
err = mkconstsv(aTHX_ newSVpvf("Too many arguments for %"SVf" (expected %d, got ", SVfARG(declarator), amax));
err = newBINOP(
mkconstpvs(")")
);
- croak = newCVREF(
+ xcroak = newCVREF(
OPf_WANT_SCALAR,
newGVOP(OP_GV, 0, gv_fetchpvs("Carp::croak", 0, SVt_PVCV))
);
err = newUNOP(OP_ENTERSUB, OPf_STACKED,
- op_append_elem(OP_LIST, err, croak));
+ op_append_elem(OP_LIST, err, xcroak));
cond = newBINOP(
OP_GT, 0,
}
if (param_spec && (count_named_params(param_spec) || (param_spec->slurpy.name && SvPV_nolen(param_spec->slurpy.name)[0] == '%'))) {
- OP *chk, *cond, *err, *croak;
+ OP *chk, *cond, *err, *xcroak;
const UV fixed = count_positional_params(param_spec) + !!param_spec->invocant.name;
err = mkconstsv(aTHX_ newSVpvf("Odd number of paired arguments for %"SVf"", SVfARG(declarator)));
- croak = newCVREF(
+ xcroak = newCVREF(
OPf_WANT_SCALAR,
newGVOP(OP_GV, 0, gv_fetchpvs("Carp::croak", 0, SVt_PVCV))
);
err = newUNOP(OP_ENTERSUB, OPf_STACKED,
- op_append_elem(OP_LIST, err, croak));
+ op_append_elem(OP_LIST, err, xcroak));
cond = newBINOP(OP_GT, 0,
newAVREF(newGVOP(OP_GV, 0, PL_defgv)),
var = newASSIGNOP(OPf_STACKED, var, 0, newOP(OP_SHIFT, 0));
*prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, var));
+
+ if (param_spec->invocant.type && (spec->flags & FLAG_CHECK_TARGS)) {
+ *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, mktypecheckp(aTHX_ declarator, 0, ¶m_spec->invocant)));
+ }
}
/* my (...) = @_; */
cond = mkhvelem(aTHX_ param_spec->rest_hash, mkconstpv(aTHX_ p + 1, n - 1));
if (spec->flags & FLAG_CHECK_NARGS) {
- OP *croak, *msg;
+ OP *xcroak, *msg;
var = mkhvelem(aTHX_ param_spec->rest_hash, mkconstpv(aTHX_ p + 1, n - 1));
var = newUNOP(OP_DELETE, 0, var);
msg = mkconstsv(aTHX_ newSVpvf("In %"SVf": missing named parameter: %.*s", SVfARG(declarator), (int)(n - 1), p + 1));
- croak = newCVREF(
+ xcroak = newCVREF(
OPf_WANT_SCALAR,
newGVOP(OP_GV, 0, gv_fetchpvs("Carp::croak", 0, SVt_PVCV))
);
- croak = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, msg, croak));
+ xcroak = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, msg, xcroak));
cond = newUNOP(OP_EXISTS, 0, cond);
- cond = newCONDOP(0, cond, var, croak);
+ cond = newCONDOP(0, cond, var, xcroak);
}
var = my_var(
if (!param_spec->slurpy.name) {
if (spec->flags & FLAG_CHECK_NARGS) {
/* croak if %{rest} */
- OP *croak, *cond, *keys, *msg;
+ OP *xcroak, *cond, *keys, *msg;
keys = newUNOP(OP_KEYS, 0, my_var_g(aTHX_ OP_PADHV, 0, param_spec->rest_hash));
keys = newLISTOP(OP_SORT, 0, newOP(OP_PUSHMARK, 0), keys);
msg = mkconstsv(aTHX_ newSVpvf("In %"SVf": no such named parameter: ", SVfARG(declarator)));
msg = newBINOP(OP_CONCAT, 0, msg, keys);
- croak = newCVREF(
+ xcroak = newCVREF(
OPf_WANT_SCALAR,
newGVOP(OP_GV, 0, gv_fetchpvs("Carp::croak", 0, SVt_PVCV))
);
- croak = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, msg, croak));
+ xcroak = newUNOP(OP_ENTERSUB, OPf_STACKED, op_append_elem(OP_LIST, msg, xcroak));
cond = newUNOP(OP_KEYS, 0, my_var_g(aTHX_ OP_PADHV, 0, param_spec->rest_hash));
- croak = newCONDOP(0, cond, croak, NULL);
+ xcroak = newCONDOP(0, cond, xcroak, NULL);
- *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, croak));
+ *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, xcroak));
} else {
OP *clear;
*prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, clear));
}
}
+
+ if (spec->flags & FLAG_CHECK_TARGS) {
+ size_t i, lim, base;
+
+ base = 1;
+ for (i = 0, lim = param_spec->positional_required.used; i < lim; i++) {
+ Param *cur = ¶m_spec->positional_required.data[i];
+
+ if (cur->type) {
+ *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, mktypecheckp(aTHX_ declarator, base + i, cur)));
+ }
+ }
+ base += i;
+
+ for (i = 0, lim = param_spec->positional_optional.used; i < lim; i++) {
+ Param *cur = ¶m_spec->positional_optional.data[i].param;
+
+ if (cur->type) {
+ *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, mktypecheckp(aTHX_ declarator, base + i, cur)));
+ }
+ }
+ base += i;
+
+ for (i = 0, lim = param_spec->named_required.used; i < lim; i++) {
+ Param *cur = ¶m_spec->named_required.data[i];
+
+ if (cur->type) {
+ *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, mktypecheckp(aTHX_ declarator, base + i, cur)));
+ }
+ }
+ base += i;
+
+ for (i = 0, lim = param_spec->named_optional.used; i < lim; i++) {
+ Param *cur = ¶m_spec->named_optional.data[i].param;
+
+ if (cur->type) {
+ *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, mktypecheckp(aTHX_ declarator, base + i, cur)));
+ }
+ }
+ base += i;
+
+ if (param_spec->slurpy.type) {
+ /* $type->valid($_) or croak $type->get_message($_) for @rest / values %rest */
+ OP *body, *list, *loop;
+
+ body = mktypecheck(aTHX_ declarator, base, param_spec->slurpy.name, NOT_IN_PAD, param_spec->slurpy.type);
+
+ if (SvPV_nolen(param_spec->slurpy.name)[0] == '@') {
+ list = my_var_g(aTHX_ OP_PADAV, 0, param_spec->slurpy.padoff);
+ } else {
+ list = my_var_g(aTHX_ OP_PADHV, 0, param_spec->slurpy.padoff);
+ list = newUNOP(OP_VALUES, 0, list);
+ }
+
+ loop = newFOROP(0, NULL, list, body, NULL);
+
+ *prelude_sentinel = op_append_list(OP_LINESEQ, *prelude_sentinel, newSTATEOP(0, NULL, loop));
+ }
+ }
}
/* finally let perl parse the actual subroutine body */
newCONSTSUB(stash, "FLAG_CHECK_NARGS", newSViv(FLAG_CHECK_NARGS));
newCONSTSUB(stash, "FLAG_INVOCANT", newSViv(FLAG_INVOCANT));
newCONSTSUB(stash, "FLAG_NAMED_PARAMS", newSViv(FLAG_NAMED_PARAMS));
+ newCONSTSUB(stash, "FLAG_TYPES_OK", newSViv(FLAG_TYPES_OK));
+ newCONSTSUB(stash, "FLAG_CHECK_TARGS", newSViv(FLAG_CHECK_TARGS));
newCONSTSUB(stash, "HINTK_KEYWORDS", newSVpvs(HINTK_KEYWORDS));
newCONSTSUB(stash, "HINTK_FLAGS_", newSVpvs(HINTK_FLAGS_));
newCONSTSUB(stash, "HINTK_SHIFT_", newSVpvs(HINTK_SHIFT_));