mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Fix type conversion on calling LSL functions.
We had a big chaos with type conversion. That caused a bug where passing a key to a function that required a string, or vice versa, crashed the script. Diminish the chaos by modifying the parameters just prior to invocation (in lslfoldconst). We also remove the, now unnecessary, calls to force floats, either alone or within vectors or quaternions.
This commit is contained in:
parent
27eeec06cf
commit
6879037735
4 changed files with 80 additions and 47 deletions
|
@ -482,6 +482,28 @@ class Test03_Optimizer(UnitTestCase):
|
|||
self.assertRaises(EParseAlreadyDefined, self.parser.parse,
|
||||
'default { timer() {} timer() {} }')
|
||||
|
||||
p = self.parser.parse('default{timer(){\n'
|
||||
'llLog(3);llLog(3.0);\n'
|
||||
'llStringToBase64((key)"");llGetAgentInfo("");\n'
|
||||
'llStringToBase64("");llGetAgentInfo((key)"");\n'
|
||||
'}}\n'
|
||||
)
|
||||
self.opt.optimize(p, ('optimize','constfold'))
|
||||
out = self.outscript.output(p)
|
||||
self.assertEqual(out, 'default\n'
|
||||
'{\n'
|
||||
' timer()\n'
|
||||
' {\n'
|
||||
' 1.0986123;\n'
|
||||
' 1.0986123;\n'
|
||||
' "";\n'
|
||||
' 0;\n'
|
||||
' "";\n'
|
||||
' 0;\n'
|
||||
' }\n'
|
||||
'}\n'
|
||||
)
|
||||
|
||||
try:
|
||||
self.parser.parse('default { timer() { return } }')
|
||||
# should raise EParseSyntax, so it should never get here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue