//Remove unnessery blocks public override void OutABlockStm(ABlockStm node) { if (node.Parent() is AABlock) { AABlock pBlock = (AABlock)node.Parent(); AABlock cBlock = (AABlock)node.GetBlock(); int index = pBlock.GetStatements().IndexOf(node); pBlock.RemoveChild(node); for (int i = cBlock.GetStatements().Count - 1; i >= 0; i--) { pBlock.GetStatements().Insert(index, cBlock.GetStatements()[i]); } } }
public override void CaseABlockStm(ABlockStm node) { InABlockStm(node); if (node.GetBlock() != null) { node.GetBlock().Apply(this); } if (node.GetToken() != null) { node.GetToken().Apply(this); } OutABlockStm(node); }