diff options
author | Mike Mazur | 2009-06-07 10:22:41 +0000 |
---|---|---|
committer | Mike Mazur | 2009-06-07 10:22:41 +0000 |
commit | 48bc2f3a4299390538efeb1c0bd97424cfa1ea28 (patch) | |
tree | ecf607b4a1dd80530faa3de69708bc1d7a4ce76a /OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs | |
parent | * Reverting the test restructuring as, on second thought, this is not at all ... (diff) | |
download | opensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.zip opensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.gz opensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.bz2 opensim-SC-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.xz |
Allow empty assignment in for-loop
For loops with no assignment are no longer syntax errors. For example,
this is now valid:
for ( ; i < 10; i++) { ... }
Corresponding changes to lsl.{lexer,parser} in r99 in opensim-libs.
Fixes Mantis #2501. Fixes Mantis #2884.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs index 0dddede..cacb8be 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/LSL2CSCodeTransformer.cs | |||
@@ -92,10 +92,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
92 | 92 | ||
93 | for (int i = 0; i < s.kids.Count; i++) | 93 | for (int i = 0; i < s.kids.Count; i++) |
94 | { | 94 | { |
95 | if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration) | 95 | // It's possible that a child is null, for instance when the |
96 | AddImplicitInitialization(s, i); | 96 | // assignment part in a for-loop is left out, ie: |
97 | // | ||
98 | // for ( ; i < 10; i++) | ||
99 | // { | ||
100 | // ... | ||
101 | // } | ||
102 | // | ||
103 | // We need to check for that here. | ||
104 | if (null != s.kids[i]) | ||
105 | { | ||
106 | if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration) | ||
107 | AddImplicitInitialization(s, i); | ||
97 | 108 | ||
98 | TransformNode((SYMBOL) s.kids[i]); | 109 | TransformNode((SYMBOL) s.kids[i]); |
110 | } | ||
99 | } | 111 | } |
100 | } | 112 | } |
101 | 113 | ||