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

538:    /* Free car */    free_type((struct pike_type *)debug_malloc_pass(car));    break; +  case PIKE_T_AUTO: +  if( car ) +  free_type((struct pike_type *)debug_malloc_pass(car)); +  break;       case T_SCOPE:    case T_ASSIGN:
668: Inside #if defined(DEBUG_MALLOC)
   case T_INT:    case T_OBJECT:    break; +  case PIKE_T_AUTO: +  break;       default:    Pike_fatal("mk_type(): Unhandled type-node: %d\n", type);
769:    push_object_type(flag, id);   }    + /* used while compiling to get the actual type of the auto type. */ + void debug_push_auto_typed_type( struct pike_type *aggregate ) + { +  copy_pike_type( *++Pike_compiler->type_stackp, +  mk_type(PIKE_T_AUTO, +  (void *)(ptrdiff_t)aggregate, +  NULL, +  0 ) ); +  + } +    void debug_push_scope_type(int level)   {    *Pike_compiler->type_stackp = mk_type(T_SCOPE,
941:    case T_MIXED:    case T_VOID:    case T_ZERO: +  case PIKE_T_AUTO:    case PIKE_T_UNKNOWN:    /* Leaf type. */    *(++Pike_compiler->type_stackp) = mk_type(type, NULL, NULL, 0);
2525:    string_builder_strcat(s, "mapping");    }    break; +  case PIKE_T_AUTO: +  my_strcat("auto"); +  break;    default:    {    string_builder_sprintf(s, "unknown code(%d)", t->type);