mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +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:
@@ -92,10 +92,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
|
||||
|
||||
for (int i = 0; i < s.kids.Count; i++)
|
||||
{
|
||||
if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration)
|
||||
AddImplicitInitialization(s, i);
|
||||
// It's possible that a child is null, for instance when the
|
||||
// assignment part in a for-loop is left out, ie:
|
||||
//
|
||||
// for ( ; i < 10; i++)
|
||||
// {
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// We need to check for that here.
|
||||
if (null != s.kids[i])
|
||||
{
|
||||
if (!(s is Assignment || s is ArgumentDeclarationList) && s.kids[i] is Declaration)
|
||||
AddImplicitInitialization(s, i);
|
||||
|
||||
TransformNode((SYMBOL) s.kids[i]);
|
||||
TransformNode((SYMBOL) s.kids[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user