Branch: Tag:

2016-01-21

2016-01-21 22:44:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Reduce duplicated code somewhat.

Use the existing typeof production also for the basic_type case.

1320:    | TOK_PROGRAM_ID opt_program_type { push_type(T_PROGRAM); }    | TOK_ARRAY_ID opt_array_type { push_type(T_ARRAY); }    | TOK_MULTISET_ID opt_array_type { push_type(T_MULTISET); } -  | TOK_TYPEOF '(' expr0 ')' { -  node *tmp; -  struct pike_type *t; -  tmp=mknode(F_COMMA_EXPR, $3, 0); -  optimize_node(tmp); -  -  t=(tmp && CAR(tmp) && CAR(tmp)->type ? CAR(tmp)->type : mixed_type_string); -  push_finished_type(t); -  free_node(tmp); +  | typeof +  { +  if ($1) { +  push_finished_type($1->u.sval.u.type);    } -  +  free_node($1); +  }    | TOK_ATTRIBUTE_ID '(' string_constant ',' full_type ')'    {    push_type_attribute($3->u.sval.u.string);