コード例 #1
0
ファイル: MockGenerator.cs プロジェクト: iTudou2016/reko
 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;
 }
コード例 #2
0
        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);
            }
        }