diff options
author | Justin Clark-Casey (justincc) | 2009-11-20 18:39:39 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-11-20 18:39:39 +0000 |
commit | 8f0db68424af54ca42928216224d1172b266250e (patch) | |
tree | 0a3f26c745502e5b065b02e611d3a054f7dc9308 | |
parent | Merge branch 'master' of ssh://dahlia@myConnection01/var/git/opensim (diff) | |
download | opensim-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.
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2e15b86..a430b1e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1266,7 +1266,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1266 | // allocations, and there is no more work to be done until someone logs in | 1266 | // allocations, and there is no more work to be done until someone logs in |
1267 | GC.Collect(); | 1267 | GC.Collect(); |
1268 | 1268 | ||
1269 | m_log.DebugFormat("[REGION]: Enabling Logins for {0}", RegionInfo.RegionName); | 1269 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); |
1270 | loginsdisabled = false; | 1270 | loginsdisabled = false; |
1271 | } | 1271 | } |
1272 | } | 1272 | } |
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(", "); |