Branch: Tag:

2000-01-02

2000-01-02 23:39:11 by Martin Stjernholm <mast@lysator.liu.se>

The least specified function is not function(mixed...:void|mixed) but
function(zero...:void|mixed). For named programs, add the constant
after the program is finished, to get the proper prototype from the
create function.

Rev: src/language.yacc:1.160

186:   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.159 1999/12/31 01:53:57 mast Exp $"); + RCSID("$Id: language.yacc,v 1.160 2000/01/02 23:39:11 mast Exp $");   #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif
1201:    push_type(T_VOID);    push_type(T_OR);    -  push_type(T_MIXED); +  push_type(T_ZERO);    push_type(T_VOID);    push_type(T_OR);   
1695:    if ($1 & ID_EXTERN) {    yywarning("Extern declared class definition.");    } -  low_start_new_program(0, $3->u.sval.u.string, $1 & ~ID_EXTERN); +  low_start_new_program(0, $3->u.sval.u.string);    if(lex.current_file)    {    store_linenumber(lex.current_line, lex.current_file);
1710:    i=isidentifier($3->u.sval.u.string);    if(i<0)    { -  low_start_new_program(new_program,0,0); +  low_start_new_program(new_program,0);    yyerror("Pass 2: program not defined!");    }else{    id=ID_FROM_INT(new_program, i);
1720:    s=&PROG_FROM_INT(new_program,i)->constants[id->func.offset].sval;    if(s->type==T_PROGRAM)    { -  low_start_new_program(s->u.program, $3->u.sval.u.string, -  $1 & ~ID_EXTERN); +  low_start_new_program(s->u.program, $3->u.sval.u.string);    }else{    yyerror("Pass 2: constant redefined!"); -  low_start_new_program(new_program, 0,0); +  low_start_new_program(new_program, 0);    }    }else{    yyerror("Pass 2: class constant no longer constant!"); -  low_start_new_program(new_program, 0,0); +  low_start_new_program(new_program, 0);    }    }    compiler_pass=tmp;
1737:    }    failsafe_program    { +  int id;    struct program *p;    if(compiler_pass == 1)    p=end_first_pass(0);
1745:       /* fprintf(stderr, "LANGUAGE.YACC: CLASS end\n"); */    -  $$=mkidentifiernode(isidentifier($3->u.sval.u.string)); -  -  if(!p) +  if(!p) { +  struct svalue s;    yyerror("Class definition failed."); -  else +  s.type = T_INT; +  s.subtype = 0; +  s.u.integer = 0; +  id = add_constant($3->u.sval.u.string, &s, $1 & ~ID_EXTERN); +  } +  else { +  struct svalue s; +  s.type = T_PROGRAM; +  s.u.program = p; +  id = add_constant($3->u.sval.u.string, &s, $1 & ~ID_EXTERN);    free_program(p); -  +  }    -  +  $$=mkidentifiernode(id); +     free_node($3);    check_tree($$,0);    }