Branch: Tag:

2016-01-16

2016-01-16 12:42:09 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Unified productions type_or_error and simple_type.

type_or_error is no more.

simple_type now moves the type directly to the compiler_frame
instead of letting it bounce on the compiler stack and having
type_or_error pick it up and move it to the compiler_frame.

280:   %type <n> number_or_maxint   %type <n> cast   %type <n> soft_cast - %type <n> simple_type +    %type <n> simple_type2   %type <n> real_string_constant   %type <n> real_string_or_identifier
628:    ;       - /* Full type moved to compiler_frame->current_type. */ - type_or_error: simple_type -  { -  if(Pike_compiler->compiler_frame->current_type) -  free_type(Pike_compiler->compiler_frame->current_type); -  copy_pike_type(Pike_compiler->compiler_frame->current_type, -  $1->u.sval.u.type); -  free_node($1); -  } -  ; -  +    open_paren_with_line_info: '('    {    /* Used to hold line-number info */
692:    *    * compiler_frame->current_type    * -  * (eg via type_or_error). +  * (eg via simple_type).    */   push_compiler_frame0: /* empty */    {
723:    }    ;    - def: modifiers optional_attributes type_or_error optional_constant + def: modifiers optional_attributes simple_type optional_constant    TOK_IDENTIFIER push_compiler_frame0    '('    {
988:    free_node($10);    free_node($<n>11);    } -  | modifiers optional_attributes type_or_error +  | modifiers optional_attributes simple_type    optional_constant TOK_IDENTIFIER push_compiler_frame0    error    {
1003:    pop_compiler_frame();    free_node($5);    } -  | modifiers optional_attributes type_or_error optional_constant bad_identifier +  | modifiers optional_attributes simple_type optional_constant bad_identifier    {    compiler_discard_type();    }
1011:    {    if ($10) free_node($10);    } -  | modifiers optional_attributes type_or_error optional_constant name_list ';' +  | modifiers optional_attributes simple_type optional_constant name_list ';'    | inheritance {}    | import {}    | constant {}
1274:    */   type2: type | identifier_type ;    - /* Full type expression. Value moved to parser value stack. */ + /* Full type expression. +  * Value moved to compiler_frame->current_type. +  */   simple_type: full_type    { -  struct pike_type *s = compiler_pop_type(); -  $$ = mktypenode(s); - #ifdef PIKE_DEBUG -  if ($$->u.sval.u.type != s) { -  Pike_fatal("mktypenode(%p) created node with %p\n", s, $$->u.sval.u.type); +  if(Pike_compiler->compiler_frame->current_type) +  free_type(Pike_compiler->compiler_frame->current_type); +  Pike_compiler->compiler_frame->current_type = compiler_pop_type();    } - #endif /* PIKE_DEBUG */ -  free_type(s); -  } +     ;      /* Basic_type-prefixed expression or an identifier type.
2396:    }    ;    - create_arg: modifiers type_or_error optional_dot_dot_dot TOK_IDENTIFIER + create_arg: modifiers simple_type optional_dot_dot_dot TOK_IDENTIFIER    {    struct pike_type *type;    int ref_no;
2438:    free_node($4);    $$=0;    } -  | modifiers type_or_error bad_identifier { $$=0; } +  | modifiers simple_type bad_identifier { $$=0; }    ;      create_arguments2: create_arg { $$ = 1; }