pike.git
/
src
/
pike_types.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/pike_types.cmod:11922:
push_type(T_NOT); push_type(fun_type->type); tmp = fun_type = pop_unfinished_type(); } { struct remap_state remap; struct pike_type *old_res; struct pike_type *fun_cont; enum pt_remap_flags remap_flags = 0;
+
struct pike_type *arg_match = NULL;
INIT_REMAP_STATE(remap); #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, "%*sChecking argument type ", indent*2+2, ""); simple_describe_type(arg_type); fprintf(stderr, " against function type "); simple_describe_type(fun_type); fprintf(stderr, ".\n");
pike.git/src/pike_types.cmod:11963:
low_type_binop(PT_BINOP_MINUS, arg_type, tmp2, &remap, PT_FLAG_CMP_VOID_IS_ZERO, PT_FLAG_CMP_VOID_IS_ZERO, remap_flags|PT_FLAG_REMAP_EVAL_MARKERS); if (bin_t) { /* Partial or strict mismatch. */ free_type(bin_t);
-
if (flags & (CALL_INVERTED_TYPES|CALL_STRICT)) {
+
if (
(
flags & (CALL_INVERTED_TYPES|CALL_STRICT))
||
+
(bin_t == arg_type))
{
goto no_match; } /* Partial matches allowed. */
-
bin
_
t
= low_type_binop(PT_BINOP_AND,
+
arg
_
match
= low_type_binop(PT_BINOP_AND,
arg_type, tmp2, &remap, PT_FLAG_CMP_VOID_IS_ZERO, PT_FLAG_CMP_VOID_IS_ZERO, remap_flags);
-
if (!
bin
_
t
) {
+
if (!
arg
_
match
) {
no_match: /* No match. */ #ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, "%*sNo match.\n", indent*2+2, ""); } #endif /* PIKE_DEBUG */ res = NULL; if (tmp) free_type(tmp); EXIT_REMAP_STATE(remap); break; }
-
-
free_type(bin_t);
+
} } if (flags & CALL_ARG_LVALUE) { /* Undo the lvalue swap from above. */ struct pike_type *tmp3 = tmp2; tmp2 = arg_type; arg_type = tmp3; remap_flags ^= PT_FLAG_REMAP_SWAP_MARKERS; } }
-
+
if (!arg_match) {
+
arg_match = arg_type;
+
if(arg_match) {
+
add_ref(arg_match);
+
}
+
}
+
/* Match. */ if (fun_type->type == PIKE_T_FUNCTION) { struct pike_type *t = NULL; /* Advance to the next argument. */ fun_cont = fun_type->cdr; } else { fun_cont = fun_type; } if (tmp) free_type(tmp);
pike.git/src/pike_types.cmod:12026:
/* NB: KEEP_MARKERS is needed if we are staying on * the same function type, as it (by definition) * then still holds the same assignments too. */ res = remap_markers(fun_cont, &remap, remap_flags|PT_FLAG_REMAP_SWAP_MARKERS| ((fun_type == fun_cont)? PT_FLAG_REMAP_KEEP_MARKERS:0)); EXIT_REMAP_STATE(remap);
-
}
+
-
if (
(
Pike_compiler->compiler_pass == COMPILER_PASS_LAST)
&& sval)
{
+
if (Pike_compiler->compiler_pass == COMPILER_PASS_LAST) {
while (tmp2 && (tmp2->type == PIKE_T_NAME)) { tmp2 = tmp2->cdr; } if (tmp2 && (tmp2->type == PIKE_T_ATTRIBUTE)) { struct compilation *c = MAYBE_THIS_COMPILATION; if (c) { /* Perform extra argument checking based on the attribute. */ if (!cs->m) { cs->m = allocate_mapping(0); } ref_push_string((struct pike_string *)tmp2->car);
-
+
if (sval) {
push_svalue(sval);
-
ref_push_type_value(
tmp2->cdr
);
+
} else {
+
push_undefined();
+
}
+
ref_push_type_value(
arg_match
);
ref_push_type_value(res); ref_push_mapping(cs->m); safe_apply_current(PC_APPLY_ATTRIBUTE_CONSTANT_FUN_NUM, 5); if (TYPEOF(Pike_sp[-1]) == PIKE_T_TYPE) { type_stack_mark(); push_finished_type(Pike_sp[-1].u.type); push_finished_type(res); push_type(T_AND); free_type(res); res = pop_unfinished_type(); } pop_stack(); } } }
-
+
+
free_type(arg_match);
+
}
#ifdef PIKE_DEBUG if (l_flag>2) { fprintf(stderr, "%*sSuccess.\n", indent*2+2, ""); } #endif /* PIKE_DEBUG */ break; default: /* Not a callable. */ break; }