mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
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.
This commit is contained in:
@@ -671,9 +671,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
|
||||
retstr += GenerateIndented("for (", fl);
|
||||
|
||||
// It's possible that we don't have an assignment, in which case
|
||||
// the child will be null and we only print the semicolon.
|
||||
// for ( x = 0 ; x < 10 ; x++ )
|
||||
// ^^^^^^^
|
||||
retstr += GenerateForLoopStatement((ForLoopStatement) fl.kids.Pop());
|
||||
ForLoopStatement s = (ForLoopStatement) fl.kids.Pop();
|
||||
if (null != s)
|
||||
{
|
||||
retstr += GenerateForLoopStatement(s);
|
||||
}
|
||||
retstr += Generate("; ");
|
||||
// for ( x = 0 ; x < 10 ; x++ )
|
||||
// ^^^^^^^^
|
||||
|
||||
Reference in New Issue
Block a user