public override void CaseAMultiLocalDecl(AMultiLocalDecl node) { PStm pStm = Util.GetAncestor<PStm>(node); if (!(pStm.Parent() is AABlock)) { return; } AABlock pBlock = (AABlock) pStm.Parent(); List<AALocalDecl> newDecls = new List<AALocalDecl>(); foreach (AALocalDeclRight right in node.GetLocalDeclRight()) { if (right.GetName() == null) { continue; } if ((right.GetAssignop() == null) != (right.GetInit() == null)) { continue; } AALocalDecl localDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, node.GetConst() != null ? (TConst) node.GetConst().Clone() : null, (PType) node.GetType().Clone(), right.GetName(), right.GetInit()); newDecls.Add(localDecl); pBlock.GetStatements().Insert(pBlock.GetStatements().IndexOf(pStm), new ALocalDeclStm(new TSemicolon(";"), localDecl)); } pBlock.RemoveChild(pStm); foreach (AALocalDecl localDecl in newDecls) { localDecl.Apply(this); } }
public override void CaseAMultiLocalDecl(AMultiLocalDecl node) { InAMultiLocalDecl(node); { Object[] temp = new Object[node.GetLocalDeclRight().Count]; node.GetLocalDeclRight().CopyTo(temp, 0); for (int i = temp.Length - 1; i >= 0; i--) { ((PLocalDeclRight)temp[i]).Apply(this); } } if (node.GetType() != null) { node.GetType().Apply(this); } if (node.GetConst() != null) { node.GetConst().Apply(this); } OutAMultiLocalDecl(node); }