mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Mark a couple bugs found to not lose track, and add a regression test.
This commit is contained in:
parent
980adff9c8
commit
30a07db4fb
2 changed files with 19 additions and 0 deletions
|
@ -1652,6 +1652,8 @@ list lazy_list_set(list L, integer i, list v)
|
|||
# we always do and open a new scope for it. At worst it will be
|
||||
# empty. At least it is not reflected as braces in the code if
|
||||
# braces are not used.
|
||||
# FIXME: This causes issues with this code that should work:
|
||||
# default{timer(){ jump x; while(1) @x; }}
|
||||
self.PushScope()
|
||||
|
||||
self.breakstack.append([self.GenerateLabel(), self.scopeindex, False])
|
||||
|
|
|
@ -227,6 +227,15 @@ class Test02_Parser(UnitTestCase):
|
|||
self.parser.parse('f(){if(1) {state default;}if (1) if (1) state default; else state default;}default{timer(){}}')
|
||||
self.parser.parse('default{timer(){vector v;v.x=0;}}')
|
||||
|
||||
# Check for exceptions only
|
||||
p = self.parser.parse('default{timer(){jump x;while(1)@x;}}')
|
||||
self.outscript.output(p)
|
||||
|
||||
self.assertRaises(EParseUndefined, self.parser.parse,
|
||||
'default{timer(){jump x;while(1){@x;}}}')
|
||||
self.assertRaises(EParseUndefined, self.parser.parse,
|
||||
'default{timer(){jump x;{while(1)@x;}}}')
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
del self.parser
|
||||
|
@ -478,6 +487,14 @@ class Test03_Optimizer(UnitTestCase):
|
|||
# should raise no other exception
|
||||
self.assertFalse(True)
|
||||
|
||||
p = self.parser.parse('default{timer(){jump x;while(1)@x;}}')
|
||||
self.opt.optimize(p)
|
||||
out = self.outscript.output(p)
|
||||
print out
|
||||
# FIXME: DCR produces invalid code, thinks the while can be eliminated
|
||||
# due to the jump jumping past it. Extremely corner case, but maybe
|
||||
# worth a fix.
|
||||
|
||||
def tearDown(self):
|
||||
del self.parser
|
||||
del self.opt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue