Ejemplo n.º 1
0
 public void Decode_should_parse_whole_stream()
 {
     var il = new byte[]{ 0, 1, 20 };
     var expected = new[]{ "nop", "break", "ldnull" };
     var ir = new InstructionReader(this, il);
     var result = new List<Instruction>(ir.ReadToEnd());
     Assert.That(result.Map(x => x.ToString()).ToList(), Is.EquivalentTo(expected));
 }
Ejemplo n.º 2
0
 void CheckDecode(string expected, params byte[] il)
 {
     var ir = new InstructionReader(this, il);
     var result = new List<Instruction>(ir.ReadToEnd());
     Assert.AreEqual(expected, result[0].ToString());
 }
Ejemplo n.º 3
0
 public IEnumerable<Instruction> DecodeBody(ITypeLoader typeLoader)
 {
     var body = method.GetMethodBody();
     if (body == null)
         return Empty;
     var tokens = new TokenResolver(typeLoader, method);
     var ir = new InstructionReader(tokens, body.GetILAsByteArray());
     return ir.ReadToEnd();
 }