Branch: Tag:

2016-01-04

2016-01-04 14:57:56 by Per Hedbor <ph@opera.com>

First stage of the 'auto' type.

Works, but for now only for variable declarations, not return types
(entirely, most of the plumbing is done) or for variables declared in
foreach and sscanf.

Since the loop variables in foreach is really the most important
location, this is of somewhat limited use so far.

Commited for safekeeping.

Conflicts:
src/language.yacc
src/lexer.h
src/pike_types.c
src/svalue.h

5512:    return ret;   }    + int is_auto_variable_type( int variable ) + { +  struct identifier *id=ID_FROM_INT(Pike_compiler->new_program,variable); +  if( id && id->type->type == PIKE_T_AUTO ) +  return 1; +  return 0; + } +  + void fix_auto_variable_type( int variable, struct pike_type *type ) + { +  /* Update the type of a program variable (basically, if it's +  * marked 'auto', set it to the given type) +  */ +  struct identifier *id=ID_FROM_INT(Pike_compiler->new_program,variable); +  if( id && id->type->type == PIKE_T_AUTO ) +  { +  free_type(id->type); +  copy_pike_type(id->type, type); +  } +  return; + } +    /* argument must be a shared string */   int define_variable(struct pike_string *name,    struct pike_type *type,