Branch: Tag:

2012-10-02

2012-10-02 10:03:44 by Per Hedbor <ph@opera.com>

[compiler] fix_type_field now fixes the type of car/cdr

This is needed to make it possible to run fix_type_field before the
tree has been completed.

it is used by the new conditional indexing operator.

3277:    n->type = 0;    n->node_info &= ~OPT_TYPE_NOT_FIXED;    +  /* +  These two are needed if we want to extract types +  from nodes while building the tree. +  */ +  if( CAR(n) ) fix_type_field(CAR(n)); +  if( CDR(n) ) fix_type_field(CDR(n)); +     switch(n->token)    {    case F_SOFT_CAST:
3327:    copy_pike_type(n->type, mixed_type_string);    break;    } +     if(!match_types(CAR(n)->type, mixed_type_string))    yyerror("Bad conditional expression.");