Fix issue 1860; exception thrown in the parser on if/if-else/for/while/do-while

statements with no body.
This commit is contained in:
Mike Mazur
2008-07-31 01:27:33 +00:00
parent 1c8f490573
commit eef3864278
5 changed files with 153 additions and 20 deletions

View File

@@ -388,14 +388,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
private string GenerateStatement(Statement s)
{
string retstr = String.Empty;
// Jump label prints its own colon, we don't need a semicolon.
bool printSemicolon = !(s.kids.Top is JumpLabel);
bool printSemicolon = true;
retstr += Indent();
foreach (SYMBOL kid in s.kids)
retstr += GenerateNode(kid);
if (0 < s.kids.Count)
{
// Jump label prints its own colon, we don't need a semicolon.
printSemicolon = !(s.kids.Top is JumpLabel);
foreach (SYMBOL kid in s.kids)
retstr += GenerateNode(kid);
}
if (printSemicolon)
retstr += GenerateLine(";");