mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
glsl: Fix scoping bug in if statements.
Fixes glslparsertest/glsl2/scoping-01.frag (successfully compiled but should've failed) and scoping-02.frag (assertion triggered).
This commit is contained in:
parent
cf37ba3430
commit
665d75cc5a
1 changed files with 8 additions and 2 deletions
|
|
@ -2395,11 +2395,17 @@ ast_selection_statement::hir(exec_list *instructions,
|
|||
|
||||
ir_if *const stmt = new(ctx) ir_if(condition);
|
||||
|
||||
if (then_statement != NULL)
|
||||
if (then_statement != NULL) {
|
||||
state->symbols->push_scope();
|
||||
then_statement->hir(& stmt->then_instructions, state);
|
||||
state->symbols->pop_scope();
|
||||
}
|
||||
|
||||
if (else_statement != NULL)
|
||||
if (else_statement != NULL) {
|
||||
state->symbols->push_scope();
|
||||
else_statement->hir(& stmt->else_instructions, state);
|
||||
state->symbols->pop_scope();
|
||||
}
|
||||
|
||||
instructions->push_tail(stmt);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue