pike.git
/
src
/
pike_types.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/pike_types.cmod:4401:
* function(t, @transitive(function(t...:x), * function(x, a, b, c, ...:c)))) | * expand(transitive(function(a, b, ...: c), * function(x, a, b, ...:c))) */ DECLARE_CYCLIC(); push_remap_markers(cont, remap, flags); if (!BEGIN_CYCLIC(cont, trans)) {
+
struct call_state cs;
+
SET_CYCLIC_RET(1); /* Check many arg. */ push_remap_markers(cont->car, remap, flags); if (peek_type_stack() != void_type_string) { push_finished_type(trans); push_remap_markers(cont, remap, flags); push_type(PIKE_T_TRANSITIVE); push_reverse_type(PIKE_T_FUNCTION); push_type(T_OR); } else { compiler_discard_top_type(); } push_remap_markers(cont->cdr, remap, flags);
-
tmp = low_new_check_call(trans, peek_type_stack(), 0, NULL);
+
INIT_CALL_STATE(cs);
+
tmp = low_new_check_call(trans, peek_type_stack(), 0,
&cs,
NULL);
+
FREE_CALL_STATE(cs);
compiler_discard_top_type(); if (tmp) { /* Valid recursion. */ push_expand_transitive_remap(tmp, trans, remap, flags, 0); free_type(tmp); push_type(T_OR); } } END_CYCLIC();
pike.git/src/pike_types.cmod:8098:
* function(t, @transitive(function(t...:x), * function(x, a, b, c, ...:c)))) | * expand(transitive(function(a, b, ...: c), * function(x, a, b, ...:c))) */ DECLARE_CYCLIC(); push_finished_type_with_markers(cont, markers, 0); if (!BEGIN_CYCLIC(cont, trans)) {
+
struct call_state cs;
+
SET_CYCLIC_RET(1); /* Check many arg. */ push_finished_type_with_markers(cont->car, markers, 0); if (peek_type_stack() != void_type_string) { push_finished_type(trans); push_finished_type(cont); push_type(PIKE_T_TRANSITIVE); push_reverse_type(PIKE_T_FUNCTION); push_type(T_OR); } else { compiler_discard_top_type(); } push_finished_type_with_markers(cont->cdr, markers, 0);
-
tmp = low_new_check_call(trans, peek_type_stack(), 0, NULL);
+
INIT_CALL_STATE(cs);
+
tmp = low_new_check_call(trans, peek_type_stack(), 0,
&cs,
NULL);
+
FREE_CALL_STATE(cs);
compiler_discard_top_type(); if (tmp) { /* Valid recursion. */ push_expand_transitive_type(tmp, trans, markers, 0); free_type(tmp); push_type(T_OR); } } END_CYCLIC();
pike.git/src/pike_types.cmod:9819:
* * @param b * The function type for the arguments. * * See also check_call(). */ static int low_get_return_type(struct pike_type *a, struct pike_type *b) { struct compilation *c = THIS_COMPILATION; struct pike_type *t;
+
struct call_state cs;
int tmp; CHECK_COMPILER(); #if 0 switch(a->type & PIKE_T_MASK) { case T_OR: { struct pike_type *o1, *o2;
pike.git/src/pike_types.cmod:9954:
free_type(t); } return 0; #else if (!a) return 0; add_ref(a); push_type(PIKE_T_UNKNOWN);
+
INIT_CALL_STATE(cs);
+
do { struct pike_type *cont; if (!b || b->type == T_MANY || (b->car && (b->car->flags & PT_FLAG_VOIDABLE))) { struct pike_type *tmp = new_get_return_type(a, 0); if (tmp) { push_finished_type(tmp); push_type(T_OR);
pike.git/src/pike_types.cmod:9979:
break; } } #ifdef PIKE_DEBUG if ((b->type != T_MANY) && (b->type != T_FUNCTION)) { Pike_fatal("Invalid argument type to check_call().\n"); } #endif
-
cont = low_new_check_call(a, b->car, 0, NULL);
+
cont = low_new_check_call(a, b->car, 0,
&cs,
NULL);
+
free_type(a); a = cont; if (!a) break; if (b->type == T_FUNCTION) b = b->cdr; } while(1);
-
if (
a
)
{
+
FREE_CALL_STATE(cs);
+
+
#
if
0
+
fprintf
(
stderr, "==> "
)
;
+
simple_describe_type(peek_type_stack());
+
fprintf(stderr, "\n\n");
+
#endif
+
free_type(a); if (peek_type_stack()) { return 1; }
-
}
+
compiler_discard_top_type(); return 0; #endif } int match_types(struct pike_type *a, struct pike_type *b) { struct pike_type *res;
pike.git/src/pike_types.cmod:10214:
p = id_to_program(CDR_TO_INT(t)); comefrom_int_index: if(p && n) { INT32 i; if(n->token == F_ARROW) { if((i=FIND_LFUN(p,LFUN_ARROW))!=-1) {
-
INT32
args
=
0
;
+
struct
call_state
cs;
+
INIT_CALL_STATE(cs)
;
add_ref(tmp = ID_FROM_INT(p, i)->type);
-
if ((
tmp = new_check_call(lfun_strings[LFUN_ARROW], tmp, CDR(n),
-
&args, 0
)
))
{
+
tmp = new_check_call(lfun_strings[LFUN_ARROW], tmp, CDR(n),
&cs,
0);
+
FREE_CALL_STATE(cs);
+
if
(tmp
) {
struct pike_type *ret = new_get_return_type(tmp, 0); free_type(tmp); if (ret) return ret; } /* Invalid type for lfun::`->(). */ add_ref(mixed_type_string); return mixed_type_string; } }else{ if((i=FIND_LFUN(p,LFUN_INDEX)) != -1) {
-
INT32
args
=
0
;
+
struct
call_state
cs;
+
INIT_CALL_STATE(cs)
;
add_ref(tmp = ID_FROM_INT(p, i)->type);
-
if ((
tmp = new_check_call(lfun_strings[LFUN_INDEX], tmp, CDR(n),
-
&args, 0
)
))
{
+
tmp = new_check_call(lfun_strings[LFUN_INDEX], tmp, CDR(n),
&cs,
0);
+
FREE_CALL_STATE(cs);
+
if
(tmp
) {
struct pike_type *ret = new_get_return_type(tmp, 0); free_type(tmp); if (ret) return ret; } /* Invalid type for lfun::`[](). */ add_ref(mixed_type_string); return mixed_type_string; } }
pike.git/src/pike_types.cmod:10839:
/* Check against the LFUN types. */ if(n && (n->token == F_ARROW)) { (i = FIND_LFUN(p,LFUN_ARROW))!=-1 || (i = FIND_LFUN(p,LFUN_ASSIGN_ARROW)); }else{ (i = FIND_LFUN(p,LFUN_INDEX))!=-1 || (i = FIND_LFUN(p,LFUN_ASSIGN_INDEX)); } if (i != -1) {
-
if
(
(
type = low_new_check_call(ID_FROM_INT(p, i)->type, index_type,
-
CALL_NOT_LAST_ARG, NULL))) {
+
struct
call_state cs;
+
INIT_CALL_STATE
(
cs);
+
type = low_new_check_call(ID_FROM_INT(p, i)->type, index_type,
+
CALL_NOT_LAST_ARG,
&cs,
NULL)
;
+
FREE_CALL_STATE(cs
)
;
+
if (type
) {
free_type(type); return 1; } return 0; } return match_types(string_type_string, index_type); }else{ return 1; } }
pike.git/src/pike_types.cmod:11594:
* * The first argument has no OR or AND nodes. * * Returns NULL on failure. * * Returns continuation function type on success. */ static struct pike_type *lower_new_check_call(struct pike_type *fun_type, struct pike_type *arg_type, INT32 flags,
+
struct call_state *cs,
struct svalue *sval #ifdef PIKE_TYPE_DEBUG , INT32 indent #define CHECK_CALL_ARGS , indent+1 #else #define CHECK_CALL_ARGS #endif /* PIKE_TYPE_DEBUG */ ) { struct compilation *c = MAYBE_THIS_COMPILATION;
pike.git/src/pike_types.cmod:11615:
struct pike_type *tmp; struct pike_type *tmp2; INT32 array_cnt = 0; #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, "%*slower_new_check_call(", indent*2, ""); simple_describe_type(fun_type); fprintf(stderr, ", "); simple_describe_type(arg_type);
-
fprintf(stderr, ", 0x%04x, %p)...\n", flags, sval);
+
fprintf(stderr, ", 0x%04x, %p
(argno:%d
)
, %p)
...\n",
+
flags,
cs, cs?cs->argno:-1,
sval);
} #endif /* PIKE_DEBUG */ loop: /* Count the number of array levels. */ while(fun_type && (fun_type->type == PIKE_T_ARRAY)) { array_cnt++; fun_type = fun_type->cdr; } switch(fun_type?(fun_type->type & PIKE_T_MASK):PIKE_T_UNKNOWN) { case T_SCOPE: /* FIXME: Save and restore the corresponding marker set. */ case T_ASSIGN: case PIKE_T_NAME: fun_type = fun_type->cdr; goto loop; case PIKE_T_ATTRIBUTE:
-
res = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS);
+
res = lower_new_check_call(fun_type->cdr, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
if (!res) return NULL; if (c) { ref_push_string((struct pike_string *)fun_type->car); ref_push_type_value(fun_type->cdr); ref_push_type_value(arg_type); safe_apply_current2(PC_APPLY_TYPE_ATTRIBUTE_FUN_NUM, 3, "apply_type_attribute"); if ((TYPEOF(Pike_sp[-1]) == T_INT) && (SUBTYPEOF(Pike_sp[-1]) == NUMBER_NUMBER) && (!Pike_sp[-1].u.integer)) {
pike.git/src/pike_types.cmod:11660:
pop_stack(); } type_stack_mark(); push_finished_type(res); push_type_attribute((struct pike_string *)fun_type->car); free_type(res); res = pop_unfinished_type(); break; case T_OR:
-
res = lower_new_check_call(fun_type->car, arg_type, flags, sval CHECK_CALL_ARGS);
+
res = lower_new_check_call(fun_type->car, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
if (!res) {
-
res = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS);
+
res = lower_new_check_call(fun_type->cdr, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
break; }
-
tmp = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS);
+
tmp = lower_new_check_call(fun_type->cdr, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
if (!tmp) break; res = or_pike_types(tmp2 = res, tmp, 1); free_type(tmp); free_type(tmp2); break; case T_AND:
-
res = lower_new_check_call(fun_type->car, arg_type, flags, sval CHECK_CALL_ARGS);
+
res = lower_new_check_call(fun_type->car, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
if (!res) break;
-
tmp = lower_new_check_call(fun_type->cdr, arg_type, flags, sval CHECK_CALL_ARGS);
+
tmp = lower_new_check_call(fun_type->cdr, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
if (!tmp) { free_type(res); res = NULL; break; } if (res == tmp) { /* Common case. */ free_type(tmp); break; }
pike.git/src/pike_types.cmod:11708:
case T_NOT: if (arg_type && (arg_type->type == T_NOT)) { /* Both sides are inverted. Pop both inversions. */ arg_type = arg_type->car; fun_type = fun_type->car; flags ^= CALL_INVERTED_TYPES; goto loop; } else { res = lower_new_check_call(fun_type->car, arg_type, flags ^ CALL_INVERTED_TYPES,
-
sval CHECK_CALL_ARGS);
+
cs,
sval CHECK_CALL_ARGS);
if (res) { /* The argument matched the function type. */ /* Move the inversion back to the function type. */ type_stack_mark(); push_finished_type(res); free_type(res); push_type(T_NOT); res = pop_unfinished_type(); } else { /* The argument did not match the function type.
pike.git/src/pike_types.cmod:11758:
type_stack_mark(); push_finished_type(fun_type->car); push_type(T_MIXED); push_type(T_VOID); push_type(T_OR); push_type(T_MANY); fun_type = pop_unfinished_type(); } else { fun_type = zzap_function_return(tmp, fun_type->car); }
-
res = lower_new_check_call(fun_type, arg_type, flags, sval CHECK_CALL_ARGS);
+
res = lower_new_check_call(fun_type, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
free_type(fun_type); break; case PIKE_T_OBJECT: fun_type = low_object_lfun_type(fun_type, LFUN_CALL); if (fun_type) goto loop; /* FIXME: Multiple cases: * Untyped object. mixed * Failed to lookup program id. mixed
pike.git/src/pike_types.cmod:11782:
/* FALLTHRU */ case PIKE_T_MIXED: copy_pike_type(res, mixed_type_string); break; case PIKE_T_OPERATOR: tmp = apply_type_operator(fun_type->type, fun_type->car, fun_type->cdr); if (!tmp) { return NULL; }
-
res = lower_new_check_call(tmp, arg_type, flags, sval CHECK_CALL_ARGS);
+
res = lower_new_check_call(tmp, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
free_type(tmp); break; case PIKE_T_TRANSITIVE: #if 0 /* NB: In theory we could use expand_transitive() here and recurse, * but this leads to a combinatorial explosion. */ tmp = expand_transitive(fun_type, a_markers, 0);
-
res = lower_new_check_call(tmp, arg_type, flags, sval CHECK_CALL_ARGS);
+
res = lower_new_check_call(tmp, arg_type, flags,
+
cs,
sval CHECK_CALL_ARGS);
free_type(tmp); #else /* There are two cases here; arg_type can belong to either * fun_type->car, or (if fun_type->car can return here) the * second argument to fun_type->cdr (or both). */ if (fun_type->car) { tmp = new_get_return_type(fun_type->car, 0); } else { tmp = new_get_return_type(fun_type->cdr, 0); } if (tmp) {
-
tmp2 = low_new_check_call(fun_type->cdr, tmp, 0, NULL);
+
tmp2 = low_new_check_call(fun_type->cdr, tmp, 0,
cs,
NULL);
free_type(tmp); tmp = NULL; if (tmp2) { /* tmp is a valid argument to fun_type->cdr, * so check if arg_type is also valid. */ tmp = lower_new_check_call(tmp2, arg_type, flags,
-
sval CHECK_CALL_ARGS);
+
cs,
sval CHECK_CALL_ARGS);
free_type(tmp2); } } if (fun_type->car) {
-
tmp2 = lower_new_check_call(fun_type->car, arg_type,
-
flags
, sval CHECK_CALL_ARGS);
+
tmp2 = lower_new_check_call(fun_type->car, arg_type,
flags,
+
cs
, sval CHECK_CALL_ARGS);
} else {
-
tmp2 = lower_new_check_call(fun_type->cdr, arg_type,
-
flags
, sval CHECK_CALL_ARGS);
+
tmp2 = lower_new_check_call(fun_type->cdr, arg_type,
flags,
+
cs
, sval CHECK_CALL_ARGS);
} if (tmp2) { if (!tmp) { tmp = tmp2; } else { /* NB: Using arg_type as a temporary variable. */ arg_type = or_pike_types(tmp, tmp2, 1); free_type(tmp); free_type(tmp2); tmp = arg_type;
pike.git/src/pike_types.cmod:12052:
* * If the argument is a constant, sval will contain a pointer to it. * * Returns NULL on failure. * * Returns continuation function type on success. */ struct pike_type *low_new_check_call(struct pike_type *fun_type, struct pike_type *arg_type, INT32 flags,
+
struct call_state *cs,
struct svalue *sval) { struct pike_type *tmp; struct pike_type *tmp2; struct pike_type *res; /* FIXME: In strict mode we need to differentiate between * two different kinds of OR: * * Complex types, eg * function(int:int)|function(float:float)
pike.git/src/pike_types.cmod:12104:
case T_OR: if (arg_type->car == zero_type_string) { arg_type = arg_type->cdr; goto loop; } if (arg_type->cdr == zero_type_string) { arg_type = arg_type->car; goto loop; } if (!(tmp = low_new_check_call(fun_type, arg_type->car,
-
flags | CALL_WEAK_VOID, sval))) {
+
flags | CALL_WEAK_VOID,
cs,
sval))) {
if (flags & CALL_STRICT) { return NULL; } arg_type = arg_type->cdr; goto loop; } if (!(tmp2 = low_new_check_call(fun_type, arg_type->cdr,
-
flags | CALL_WEAK_VOID, sval))) {
+
flags | CALL_WEAK_VOID,
cs,
sval))) {
if (flags & CALL_STRICT) { free_type(tmp); return NULL; } return tmp; } res = or_pike_types(tmp, tmp2, 1); free_type(tmp); free_type(tmp2); return res; case T_AND: if (!(tmp = low_new_check_call(fun_type, arg_type->car,
-
flags & ~CALL_WEAK_VOID, sval))) {
+
flags & ~CALL_WEAK_VOID,
cs,
sval))) {
return NULL; } if (!(tmp2 = low_new_check_call(fun_type, arg_type->cdr,
-
flags & ~CALL_WEAK_VOID, sval))) {
+
flags & ~CALL_WEAK_VOID,
cs,
sval))) {
free_type(tmp); return NULL; } if (tmp == tmp2) { free_type(tmp2); return tmp; } type_stack_mark(); push_finished_type(tmp); push_finished_type(tmp2);
pike.git/src/pike_types.cmod:12156:
case T_VOID: if ((flags & (CALL_WEAK_VOID|CALL_STRICT)) == CALL_STRICT) { return NULL; } /* Promote void arguments to zero. */ arg_type = zero_type_string; break; } if (!(tmp = lower_new_check_call(fun_type, arg_type,
-
flags & ~CALL_WEAK_VOID, sval
+
flags & ~CALL_WEAK_VOID,
cs,
sval
#ifdef PIKE_TYPE_DEBUG , 0 #endif ))) { struct pike_type *tmp2; if (!(flags & CALL_STRICT) || !arg_type || (arg_type->type != T_INT) || (CAR_TO_INT(arg_type) >= 0) || (CDR_TO_INT(arg_type) <= 0)) { return NULL; } /* KLUDGE: Special case for integers spanning zero.
pike.git/src/pike_types.cmod:12178:
* Try splitting the argument at zero. The proper fix would be * to split at all the integer range limits for the first * declared argument to the function. * * Test the most likely problematic range first (ie negative). */ type_stack_mark(); push_int_type(CAR_TO_INT(arg_type), -1); tmp2 = pop_unfinished_type(); if (!(tmp = lower_new_check_call(fun_type, tmp2,
-
flags & ~CALL_WEAK_VOID, sval
+
flags & ~CALL_WEAK_VOID,
cs,
sval
#ifdef PIKE_TYPE_DEBUG , 0 #endif ))) { free_type(tmp2); return NULL; } free_type(tmp2); type_stack_mark(); push_finished_type(tmp); free_type(tmp); /* Then the positive range. */ type_stack_mark(); push_int_type(1, CDR_TO_INT(arg_type)); tmp2 = pop_unfinished_type(); if (!(tmp = lower_new_check_call(fun_type, tmp2,
-
flags & ~CALL_WEAK_VOID, sval
+
flags & ~CALL_WEAK_VOID,
cs,
sval
#ifdef PIKE_TYPE_DEBUG , 0 #endif ))) { free_type(tmp2); free_type(pop_unfinished_type()); return NULL; } free_type(tmp2);
pike.git/src/pike_types.cmod:12785:
fprintf(stderr, "\n"); } #endif return res; } /* NOTE: fun_type loses a reference. */ struct pike_type *check_splice_call(struct pike_string *fun_name, struct pike_type *fun_type,
-
INT32
argno
,
+
struct
call_state *cs
,
struct pike_type *args_type, struct svalue *sval, INT32 flags) { struct compilation *c = THIS_COMPILATION; struct pike_type *res = NULL; struct pike_type *arg_type = index_type(args_type, int_type_string, NULL); struct pike_type *ind_type = key_type(args_type, NULL); INT_TYPE ind_range[2] = { 256, 0 }; int min_cnt = 0;
pike.git/src/pike_types.cmod:12817:
max_cnt = 256; } if (min_cnt < 0) min_cnt = 0; if (max_cnt > 256) max_cnt = 256; } #ifdef PIKE_DEBUG if (l_flag>4) { fprintf(stderr, "check_splice_call(\"%s\", ", fun_name->str); simple_describe_type(fun_type);
-
fprintf(stderr, ",\n %d, ", argno);
+
fprintf(stderr, ",\n %d, ",
cs->
argno);
simple_describe_type(args_type); fprintf(stderr, ",\n %p, 0x%04x)", sval, flags); fprintf(stderr, "\n range: [%d..%d] ", min_cnt, max_cnt); simple_describe_type(ind_type); } #endif /* PIKE_DEBUG */ /* Loop until we get a stable fun_type, or it's an invalid argument. */ for (cnt = 0;; cnt++) { struct pike_type *prev = NULL;
pike.git/src/pike_types.cmod:12849:
if ((res == prev) || (prev && (res == fun_type))) { /* Stable result. */ break; } } if (cnt >= max_cnt) break; fun_type = low_new_check_call(prev = fun_type, arg_type,
-
flags | CALL_NOT_LAST_ARG, sval);
+
flags | CALL_NOT_LAST_ARG,
cs,
sval);
free_type(prev); #ifdef PIKE_DEBUG if (l_flag>4) { fprintf(stderr, "\n sub_result_type: "); simple_describe_type(fun_type); } #endif /* PIKE_DEBUG */ if (!fun_type || (fun_type == prev)) {
pike.git/src/pike_types.cmod:12872:
} } if (fun_type || (cnt >= max_cnt)) { /* Max args reached or stable type. */ free_type(fun_type); } else if (!(flags & CALL_INHIBIT_WARNINGS)) { /* The splice values are invalid for later arguments. */ if (!cnt && max_cnt) { yywarning("In argument %d to %S: The @-operator argument must be an empty array.",
-
argno, fun_name);
+
cs->
argno, fun_name);
} else if (c->lex.pragmas & ID_STRICT_TYPES) { yywarning("In argument %d to %S: The @-operator argument has a max length of %d.",
-
argno, fun_name, cnt);
+
cs->
argno, fun_name, cnt);
} } free_type(ind_type); free_type(arg_type); #ifdef PIKE_DEBUG if (l_flag>4) { fprintf(stderr, "\ncheck_splice_call(...) ==> "); simple_describe_type(res); fprintf(stderr, "\n"); } #endif /* PIKE_DEBUG */ return res; } /* NOTE: fun_type loses a reference. */ static struct pike_type *new_check_call_arg(struct pike_string *fun_name, struct pike_type *fun_type,
-
node *args,
INT32
*
argno
,
+
node *args,
struct
call_state
*
cs
,
INT32 flags) { struct compilation *c = THIS_COMPILATION; struct pike_type *tmp = NULL; struct pike_type *res = NULL; struct svalue *sval = NULL; CHECK_COMPILER(); debug_malloc_touch(fun_type); if (!args || !fun_type) { debug_malloc_touch(fun_type); return fun_type; }
-
(*argno)++
;
+
cs->argno++
;
if (args->token == F_CONSTANT) { sval = &args->u.sval; } #ifdef PIKE_DEBUG if (l_flag>2) {
-
fprintf(stderr, " Checking argument #%d... ",
*
argno);
+
fprintf(stderr, " Checking argument #%d... ",
cs->
argno);
simple_describe_type(args->type); if (sval) { fprintf(stderr, "\n Constant of type %s", get_name_of_type(TYPEOF(*sval))); } fprintf(stderr, "\n fun_type: "); simple_describe_type(fun_type); } #endif /* PIKE_DEBUG */ if (args->token == F_PUSH_ARRAY) { #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, "\n The argument is a splice operator.\n"); } #endif /* PIKE_DEBUG */
-
res = check_splice_call(fun_name, fun_type,
*argno
,
-
args->type, sval, flags);
+
res = check_splice_call(fun_name, fun_type,
cs
, args->type, sval, flags);
#ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, "\n result: "); simple_describe_type(res); fprintf(stderr, " OK.\n"); } #endif /* PIKE_DEBUG */ return res; } else { #ifdef PIKE_DEBUG if (l_flag>2) fputc ('\n', stderr); #endif
-
if ((res = low_new_check_call(fun_type, args->type, flags, sval))) {
+
if ((res = low_new_check_call(fun_type, args->type, flags,
cs,
sval))) {
/* OK. */ #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, " OK.\n"); } #endif /* PIKE_DEBUG */ if ((c->lex.pragmas & ID_STRICT_TYPES) && /* FIXME: Strict types not supported for lvalues yet. */ !(flags & CALL_ARG_LVALUE)){ if (!(tmp = low_new_check_call(fun_type, args->type,
-
flags|CALL_STRICT, sval))) {
+
flags|CALL_STRICT,
cs,
sval))) {
tmp = get_first_arg_type(fun_type, flags); yytype_report(REPORT_WARNING, NULL, 0, tmp, NULL, 0, args->type, 0, "Type mismatch in argument %d to %S.",
-
*
argno, fun_name);
+
cs->
argno, fun_name);
if (tmp) free_type(tmp); } else { free_type(tmp); } } free_type(fun_type); return res; } } if ((tmp = get_first_arg_type(fun_type, flags|CALL_NOT_LAST_ARG))) { struct pike_type *tmp2; #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, " Bad argument.\n"); } #endif /* PIKE_DEBUG */ yytype_report(REPORT_ERROR, NULL, 0, tmp, NULL, 0, args->type,
-
0, "Bad argument %d to %S.",
*
argno, fun_name);
+
0, "Bad argument %d to %S.",
cs->
argno, fun_name);
/* Try advancing with the suggested type, so that we can check * the rest of the arguments. */
-
if ((tmp2 = low_new_check_call(fun_type, tmp, flags, NULL))) {
+
if ((tmp2 = low_new_check_call(fun_type, tmp, flags,
cs,
NULL))) {
/* Succeeded. */ free_type(fun_type); free_type(tmp); #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, " Created continuation type: "); simple_describe_type(tmp2); fprintf(stderr, " OK.\n"); } #endif /* PIKE_DEBUG */
pike.git/src/pike_types.cmod:13024:
free_type(tmp); } else { #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, " Too many arguments.\n"); } #endif /* PIKE_DEBUG */ yytype_report(REPORT_ERROR, NULL, 0, NULL, NULL, 0, args->type, 0, "Too many arguments to %S (expected %d arguments).",
-
fun_name,
*
argno - 1);
+
fun_name,
cs->
argno - 1);
} free_type(fun_type); return NULL; } /* NOTE: fun_type loses a reference. */ struct pike_type *new_check_call(struct pike_string *fun_name, struct pike_type *fun_type,
-
node *args,
INT32
*
argno
, INT32 flags)
+
node *args,
struct
call_state
*
cs
,
+
INT32 flags)
{ node *orig_arg_parent = NULL; INT32 orig_flags = flags; int num_cdr = 0; int num_lvalue = 0; if (!args || !fun_type) { debug_malloc_touch(fun_type); return fun_type; }
pike.git/src/pike_types.cmod:13074:
continue; } else if (CDR(args)) { CDR(args)->parent = args; args = CDR(args); if (!--num_cdr) { flags = orig_flags | (num_lvalue?CALL_ARG_LVALUE:0); } continue; } } else {
-
fun_type = new_check_call_arg(fun_name, fun_type, args,
argno
, flags);
+
fun_type = new_check_call_arg(fun_name, fun_type, args,
cs
, flags);
debug_malloc_touch(fun_type); if (!fun_type) return NULL; } do { node *prev = args; if (args->token == F_LVALUE_LIST) { if (!--num_lvalue) { flags = orig_flags | (num_cdr?CALL_NOT_LAST_ARG:0);
pike.git/src/pike_types.cmod:13107:
CDR(args)->parent = args; args = CDR(args); break; } /* CAR(args) == CDR(args), so we need to recurse * since we can't differentiate otherwise. * * This should be a quite rare case, and the tree is * most likely very shallow, so this should be safe. */
-
fun_type = new_check_call(fun_name, fun_type, prev,
argno
, flags);
+
fun_type = new_check_call(fun_name, fun_type, prev,
cs
, flags);
debug_malloc_touch(fun_type); if (!fun_type) return NULL; } } while(args); } return fun_type; }