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/CSCodeGenerator.cs | |
parent | * Reverting the test restructuring as, on second thought, this is not at all ... (diff) | |
download | opensim-SC_OLD-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.zip opensim-SC_OLD-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.gz opensim-SC_OLD-48bc2f3a4299390538efeb1c0bd97424cfa1ea28.tar.bz2 opensim-SC_OLD-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/CSCodeGenerator.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index d917939..ab9968f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | |||
@@ -671,9 +671,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
671 | 671 | ||
672 | retstr += GenerateIndented("for (", fl); | 672 | retstr += GenerateIndented("for (", fl); |
673 | 673 | ||
674 | // It's possible that we don't have an assignment, in which case | ||
675 | // the child will be null and we only print the semicolon. | ||
674 | // for ( x = 0 ; x < 10 ; x++ ) | 676 | // for ( x = 0 ; x < 10 ; x++ ) |
675 | // ^^^^^^^ | 677 | // ^^^^^^^ |
676 | retstr += GenerateForLoopStatement((ForLoopStatement) fl.kids.Pop()); | 678 | ForLoopStatement s = (ForLoopStatement) fl.kids.Pop(); |
679 | if (null != s) | ||
680 | { | ||
681 | retstr += GenerateForLoopStatement(s); | ||
682 | } | ||
677 | retstr += Generate("; "); | 683 | retstr += Generate("; "); |
678 | // for ( x = 0 ; x < 10 ; x++ ) | 684 | // for ( x = 0 ; x < 10 ; x++ ) |
679 | // ^^^^^^^^ | 685 | // ^^^^^^^^ |