Give new scopes to non-compound (simple) if-then-else substatements, correcting scoping for declarations they contain.

Also, updated several tests and the Todo list.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22845 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-08-27 03:59:04 +00:00
parent 3af0d53dac
commit d46b31fdc5
6 changed files with 272 additions and 55 deletions

View file

@ -187,7 +187,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%type <interm.intermNode> declaration external_declaration
%type <interm.intermNode> for_init_statement compound_statement_no_new_scope
%type <interm.nodePair> selection_rest_statement for_rest_statement
%type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope
%type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope statement_scoped
%type <interm> single_declaration init_declarator_list
%type <interm> parameter_declaration parameter_declarator parameter_type_specifier
@ -2599,6 +2599,10 @@ statement_no_new_scope
| simple_statement { $$ = $1; }
;
statement_scoped
: compound_statement { $$ = $1; }
| { parseContext.symbolTable.push(); } simple_statement { parseContext.symbolTable.pop(&parseContext.defaultPrecision[0]); } { $$ = $2; }
compound_statement_no_new_scope
// Statement that doesn't create a new scope, for selection_statement, iteration_statement
: LEFT_BRACE RIGHT_BRACE {
@ -2643,11 +2647,11 @@ selection_statement
;
selection_rest_statement
: statement ELSE statement {
: statement_scoped ELSE statement_scoped {
$$.node1 = $1;
$$.node2 = $3;
}
| statement {
| statement_scoped {
$$.node1 = $1;
$$.node2 = 0;
}