private IEnumerable<Identifier> CollectLocalIdentifiers(Procedure proc) { SortedList<string, Identifier> identifiers = new SortedList<string, Identifier>(); IdentifierCollector coll = new IdentifierCollector(identifiers); foreach (Block block in new DfsIterator<Block>(proc.ControlGraph).PreOrder(proc.EntryBlock)) { foreach (Statement stm in block.Statements) { stm.Instruction.Accept(coll); } } return identifiers.Values; }
private void WriteIdentifiers(Procedure proc) { var idsByName = new SortedList <string, Identifier>(); var idCollector = new IdentifierCollector(idsByName); if (proc.Signature.ParametersValid) { throw new NotImplementedException(); } foreach (var stm in proc.Statements) { stm.Instruction.Accept(idCollector); } if (idsByName.Count > 0) { js.WriteList(idsByName.Values, WriteIdentifier); } }