From 476e08286e349c9797bc1ac567d478a1f257f43d Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 14 Jul 2008 01:07:21 +0000 Subject: Mantis#1728. Thank you kindly, Mikem for a patch that solves: The compiler was missing grammar rules for += etc. operators on vector.member variables, which the attached patch implements. --- .../Shared/CodeTools/LSLCompilerTest.cs | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs index 890a634..70472cb 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSLCompilerTest.cs @@ -1360,6 +1360,41 @@ default } [Test] + public void TestVectorMemberPlusEquals() + { + string input = @"// let's test unary expressions some more + +default +{ + state_entry() + { + vector v = llGetPos(); + v.z += 4; + v.z -= 4; + v.z *= 4; + v.z /= 4; + v.z %= 4; + } +} +"; + string expected = @" + public void default_event_state_entry() + { + LSL_Types.Vector3 v = llGetPos(); + v.z += 4; + v.z -= 4; + v.z *= 4; + v.z /= 4; + v.z %= 4; + } +"; + + CSCodeGenerator cg = new CSCodeGenerator(); + string output = cg.Convert(input); + Assert.AreEqual(expected, output); + } + + [Test] [ExpectedException("Tools.CSToolsException")] public void TestSyntaxError() { -- cgit v1.1