Ticket #767: symreg.patch

File symreg.patch, 0.8 KB (added by NotFound, 5 years ago)

fail on duplicated local/param identifiers

  • compilers/imcc/symreg.c

     
    600600{ 
    601601    ASSERT_ARGS(mk_ident) 
    602602    char   * const fullname = _mk_fullname(pesky_global__namespace, name); 
    603     SymReg        *r        = mk_symreg(interp, fullname, t); 
     603    SymReg *r = _get_sym_typed(&(IMCC_INFO(interp)->last_unit->hash), name, t); 
     604    if (r) 
     605        IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, 
     606                "syntax error, duplicated IDENTIFIER '%s'", fullname); 
    604607 
     608    r = mk_symreg(interp, fullname, t); 
     609 
    605610    r->type = VTIDENTIFIER; 
    606611 
     612 
    607613    if (pesky_global__namespace) { 
    608614        Identifier * const ident = mem_allocate_zeroed_typed(Identifier); 
    609615