diff --git a/src/language.yacc b/src/language.yacc index 71a9f1586c40caeb790f5e1cf4018790014a5c11..d72057f3704c181c4f4072462b18cd850e29d209 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -889,62 +889,8 @@ def: modifiers optional_attributes type_or_error optional_constant optional_star struct pike_type *s=compiler_pop_type(); int i = isidentifier($6->u.sval.u.string); - if (Pike_compiler->compiler_pass == 1) { - if ($1 & ID_VARIANT) { - /* FIXME: Lookup the type of any existing variant */ - /* Or the types. */ - fprintf(stderr, "Pass %d: Identifier %s:\n", - Pike_compiler->compiler_pass, $6->u.sval.u.string->str); - - if (i >= 0) { - struct identifier *id = ID_FROM_INT(Pike_compiler->new_program, i); - if (id) { - struct pike_type *new_type; - fprintf(stderr, "Defined, type:\n"); -#ifdef PIKE_DEBUG - simple_describe_type(id->type); -#endif - - new_type = or_pike_types(s, id->type, 1); - free_type(s); - s = new_type; - - fprintf(stderr, "Resulting type:\n"); -#ifdef PIKE_DEBUG - simple_describe_type(s); -#endif - } else { - my_yyerror("Lost identifier %S (%d).", - $6->u.sval.u.string, i); - } - } else { - fprintf(stderr, "Not defined.\n"); - } - fprintf(stderr, "New type:\n"); -#ifdef PIKE_DEBUG - simple_describe_type(s); -#endif - } - } else { - /* FIXME: Second pass reuses the type from the end of - * the first pass if this is a variant function. - */ - if (i >= 0) { - if (Pike_compiler->new_program->identifier_references[i].id_flags & - ID_VARIANT) { - struct identifier *id = ID_FROM_INT(Pike_compiler->new_program, i); - fprintf(stderr, "Pass %d: Identifier %s:\n", - Pike_compiler->compiler_pass, $6->u.sval.u.string->str); - - free_type(s); - copy_pike_type(s, id->type); - - fprintf(stderr, "Resulting type:\n"); -#ifdef PIKE_DEBUG - simple_describe_type(s); -#endif - } - } else { + if (Pike_compiler->compiler_pass != 1) { + if (i < 0) { my_yyerror("Identifier %S lost after first pass.", $6->u.sval.u.string); } @@ -970,11 +916,6 @@ def: modifiers optional_attributes type_or_error optional_constant optional_star $4); Pike_compiler->varargs=0; - - if ($1 & ID_VARIANT) { - fprintf(stderr, "Function number: %d\n", - Pike_compiler->compiler_frame->current_function_number); - } } } block_or_semi @@ -1005,19 +946,6 @@ def: modifiers optional_attributes type_or_error optional_constant optional_star my_yyerror("Missing name for argument %d.", e - $<number>9); } else { if (Pike_compiler->compiler_pass == 2) { - if ($1 & ID_VARIANT) { - struct pike_type *arg_type = - Pike_compiler->compiler_frame->variable[e].type; - - /* FIXME: Generate code that checks the arguments. */ - /* If there is a bad argument, call the fallback, and return. */ - if (! pike_types_le(void_type_string, arg_type)) { - /* Argument my not be void. - * ie it's required. - */ - num_required_args++; - } - } else { /* FIXME: Should probably use some other flag. */ if ((runtime_options & RUNTIME_CHECK_TYPES) && (Pike_compiler->compiler_frame->variable[e].type != @@ -1037,30 +965,10 @@ def: modifiers optional_attributes type_or_error optional_constant optional_star mksoftcastnode(Pike_compiler->compiler_frame->variable[e].type, local_node)); } - } } } } - if ($1 & ID_VARIANT) { - struct pike_string *bad_arg_str; - MAKE_CONST_STRING(bad_arg_str, - "Bad number of arguments!\n"); - - fprintf(stderr, "Required args: %d\n", num_required_args); - - check_args = - mknode('?', - mkopernode("`<", - mkefuncallnode("query_num_arg", NULL), - mkintnode(num_required_args)), - mknode(':', - mkefuncallnode("throw", - mkefuncallnode("aggregate", - mkstrnode(bad_arg_str))), - NULL)); - } - if ($<number>9) { /* Hook in the initializers for the create arguments. */ for (e = $<number>9; e--;) { @@ -1088,10 +996,6 @@ def: modifiers optional_attributes type_or_error optional_constant optional_star i = ID_FROM_INT(Pike_compiler->new_program, f); i->opt_flags = Pike_compiler->compiler_frame->opt_flags; - if ($1 & ID_VARIANT) { - fprintf(stderr, "Function number: %d\n", f); - } - #ifdef PIKE_DEBUG if(Pike_interpreter.recoveries && ((Pike_sp - Pike_interpreter.evaluator_stack) < diff --git a/src/program.c b/src/program.c index b11f3dd96b31ff821b1ae0cbdb1ec36ef32fe1cc..1a9c64a21abfb2d848c946d5fddc8b7dcf9c4cdc 100644 --- a/src/program.c +++ b/src/program.c @@ -5994,12 +5994,10 @@ INT32 define_function(struct pike_string *name, /* match types against earlier prototype or vice versa */ if(!match_types(type, funp->type)) { - if (!(flags & ID_VARIANT)) { - yytype_report(REPORT_ERROR, NULL, 0, - funp->type, - NULL, 0, type, 0, - "Prototype doesn't match for function %S.", name); - } + yytype_report(REPORT_ERROR, NULL, 0, + funp->type, + NULL, 0, type, 0, + "Prototype doesn't match for function %S.", name); } }