Branch: Tag:

2018-05-23

2018-05-23 10:59:43 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Support reevaluating the type for local auto variables.

The actual type for local variables that have been declared auto,
may now be adjusted after the local variable nodes have been created.

1144:       res->node_info = OPT_NOT_CONST;    res->tree_info = res->node_info; +  if (res->type && (res->type->type == PIKE_T_AUTO)) { +  res->node_info |= OPT_TYPE_NOT_FIXED; +  }   #ifdef __CHECKER__    _CDR(res) = 0;   #endif
4055:    }    break;    +  case F_LOCAL: +  { +  struct compiler_frame *f = Pike_compiler->compiler_frame; +  int e; +  for (e = 0; f && (e < n->u.integer.b); e++) { +  f = f->previous; +  } +  if (f) { +  copy_pike_type(n->type, f->variable[n->u.integer.a].type); +  } else { +  copy_pike_type(n->type, mixed_type_string); +  } +  break; +  } +     case F_MAGIC_INDEX:    /* FIXME: Could have a stricter type for ::`->(). */    MAKE_CONSTANT_TYPE(n->type, tF_MAGIC_INDEX);