示例#1
0
        public static MessageContext Method(MessageContext parent, CCI.Method method)
        {
            var loc = default(Location);

            if (method.SourceContext.Document != null)
            {
                loc = method.SourceContext.ToLocation();
            }
            else if (method.Name != null && method.Name.SourceContext.Document != null)
            {
                loc = method.Name.SourceContext.ToLocation();
            }
            else if (method.Instructions != null && method.Instructions.Count > 1 &&
                     method.Instructions[1].SourceContext.Document != null)
            {
                loc = method.Instructions[1].SourceContext.ToLocation();
            }
            return(new MessageContext
                       (parent,
                       loc,
                       sb =>
            {
                sb.Append("Method ");
                sb.Append(method.FullName);
            }));
        }
示例#2
0
        public static MessageContext Instruction(MessageContext parent, CCI.Method method, int index)
        {
            var loc = default(Location);

            if (method.Instructions[index].SourceContext.Document != null)
            {
                loc = method.Instructions[index].SourceContext.ToLocation();
            }
            return(new MessageContext
                       (parent,
                       loc,
                       sb =>
            {
                sb.Append("Instruction ");
                sb.Append(method.Instructions[index].OpCode.ToString());
                sb.Append(" offset ");
                sb.Append(method.Instructions[index].Offset);
            }));
        }
示例#3
0
 public static MessageContext Method(CCI.Method method)
 {
     return(Method(null, method));
 }
示例#4
0
 public static MessageContext Instruction(CCI.Method method, int index)
 {
     return(Instruction(null, method, index));
 }