aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-20 18:39:39 +0000
committerJustin Clark-Casey (justincc)2009-11-20 18:39:39 +0000
commit8f0db68424af54ca42928216224d1172b266250e (patch)
tree0a3f26c745502e5b065b02e611d3a054f7dc9308 /OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
parentMerge branch 'master' of ssh://dahlia@myConnection01/var/git/opensim (diff)
downloadopensim-SC_OLD-8f0db68424af54ca42928216224d1172b266250e.zip
opensim-SC_OLD-8f0db68424af54ca42928216224d1172b266250e.tar.gz
opensim-SC_OLD-8f0db68424af54ca42928216224d1172b266250e.tar.bz2
opensim-SC_OLD-8f0db68424af54ca42928216224d1172b266250e.tar.xz
Fix http://opensimulator.org/mantis/view.php?id=3874 - parenthesis in for statements cause script compile failures
This fixes a problem in OpenSim where statements of the form for ((i = 0); (i < 10); (++i)) { ... } do not compile even though they are valid lsl.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index 41ecfd3..e427f50 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -722,8 +722,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
722 if (fls.kids.Top is IdentExpression && 1 == fls.kids.Count) 722 if (fls.kids.Top is IdentExpression && 1 == fls.kids.Count)
723 return retstr; 723 return retstr;
724 724
725 foreach (SYMBOL s in fls.kids) 725 for (int i = 0; i < fls.kids.Count; i++)
726 { 726 {
727 SYMBOL s = (SYMBOL)fls.kids[i];
728
729 // Statements surrounded by parentheses in for loops
730 //
731 // e.g. for ((i = 0), (j = 7); (i < 10); (++i))
732 //
733 // are legal in LSL but not in C# so we need to discard the parentheses
734 //
735 // The following, however, does not appear to be legal in LLS
736 //
737 // for ((i = 0, j = 7); (i < 10); (++i))
738 //
739 // As of Friday 20th November 2009, the Linden Lab simulators appear simply never to compile or run this
740 // script but with no debug or warnings at all! Therefore, we won't deal with this yet (which looks
741 // like it would be considerably more complicated to handle).
742 while (s is ParenthesisExpression)
743 s = (SYMBOL)s.kids.Pop();
744
727 retstr += GenerateNode(s); 745 retstr += GenerateNode(s);
728 if (0 < comma--) 746 if (0 < comma--)
729 retstr += Generate(", "); 747 retstr += Generate(", ");