Branch: Tag:

2016-01-04

2016-01-04 14:57:56 by Per Hedbor <ph@opera.com>

Somewhat better handling of global auto variables

1748:    $2->u.sval.u.string->str);    }   #endif /* PIKE_DEBUG */ -  if(is_auto_variable_type( $<number>4 )) +  if(Pike_compiler->compiler_frame->current_type->type == PIKE_T_AUTO)    {    // auto variable type needs to be updated. -  +  fix_type_field( $5 );    fix_auto_variable_type( $<number>4, $5->type );    }    free_node($5);
1758:    }    }    if ($5) { -  if( Pike_compiler->compiler_pass == 2 && is_auto_variable_type( $<number>4 ) ) +  // this is done in both passes to get somewhat better handling +  // of auto types. +  // +  // an example is: auto a = typeof(b); auto b = (["foo":"bar"]); +  // if this is only done in the second pass the type of a will be +  // type(auto), not type(mapping(..)) +  if( Pike_compiler->compiler_frame->current_type->type == PIKE_T_AUTO )    {    fix_type_field( $5 );    fix_auto_variable_type( $<number>4, $5->type );