From a6cce58b5daf7130a7af0d15c3219749e454f672 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Fri, 24 May 2024 20:25:39 +0200 Subject: [PATCH] Fix invocation of PythonType2LSL Fixes #32. Thanks to @KrsityKu for the report and repro. --- lslopt/lsldeadcode.py | 2 +- unit_tests/regression.suite/issue-32.lsl | 8 ++++++++ unit_tests/regression.suite/issue-32.out | 7 +++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 unit_tests/regression.suite/issue-32.lsl create mode 100644 unit_tests/regression.suite/issue-32.out diff --git a/lslopt/lsldeadcode.py b/lslopt/lsldeadcode.py index f158a10..7dba5fb 100644 --- a/lslopt/lsldeadcode.py +++ b/lslopt/lsldeadcode.py @@ -463,7 +463,7 @@ class deadcode(object): if value.nt == 'CONST': value = value.value[fieldidx] value = nr(nt='CONST', X=True, SEF=True, - t=self.PythonType2LSL[type(value)], value=value) + t=lslfuncs.PythonType2LSL[type(value)], value=value) value = self.Cast(value, 'float') SEF = True else: # assumed VECTOR or ROTATION per OKtoRemoveSymbol diff --git a/unit_tests/regression.suite/issue-32.lsl b/unit_tests/regression.suite/issue-32.lsl new file mode 100644 index 0000000..f1152e0 --- /dev/null +++ b/unit_tests/regression.suite/issue-32.lsl @@ -0,0 +1,8 @@ +default +{ + timer() + { + vector v = <1,2,3>; + llOwnerSay((string)v.x); + } +} diff --git a/unit_tests/regression.suite/issue-32.out b/unit_tests/regression.suite/issue-32.out new file mode 100644 index 0000000..6de2365 --- /dev/null +++ b/unit_tests/regression.suite/issue-32.out @@ -0,0 +1,7 @@ +default +{ + timer() + { + llOwnerSay("1.000000"); + } +}