Fix deletion of if (SEF_expr) ;
Fixes #29. Thanks @KrsityKu for the test case, which was added to the test suite.
This commit is contained in:
@@ -1819,7 +1819,7 @@ class foldconst(object):
|
|||||||
# if (X) ; -> X;
|
# if (X) ; -> X;
|
||||||
if len(child) == 2:
|
if len(child) == 2:
|
||||||
parent[index] = nr(nt='EXPR', t=child[0].t,
|
parent[index] = nr(nt='EXPR', t=child[0].t,
|
||||||
ch=[child[0]])
|
ch=[child[0]], SEF=child[0].SEF)
|
||||||
# It has been promoted to statement. Fold it as such.
|
# It has been promoted to statement. Fold it as such.
|
||||||
# (Will remove it if SEF)
|
# (Will remove it if SEF)
|
||||||
self.FoldStmt(parent, index)
|
self.FoldStmt(parent, index)
|
||||||
|
|||||||
12
unit_tests/regression.suite/issue-29.lsl
Normal file
12
unit_tests/regression.suite/issue-29.lsl
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
default
|
||||||
|
{
|
||||||
|
touch(integer num)
|
||||||
|
{
|
||||||
|
integer dead = 0;
|
||||||
|
if (num == 5)
|
||||||
|
dead = 1;
|
||||||
|
else
|
||||||
|
dead = 2;
|
||||||
|
llOwnerSay("Not Dead");
|
||||||
|
}
|
||||||
|
}
|
||||||
7
unit_tests/regression.suite/issue-29.out
Normal file
7
unit_tests/regression.suite/issue-29.out
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
default
|
||||||
|
{
|
||||||
|
touch(integer num)
|
||||||
|
{
|
||||||
|
llOwnerSay("Not Dead");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user