예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="method">Method</param>
 /// <param name="statement">Statement</param>
 public MethodSourceStatement(MethodDef method, SourceStatement statement)
 {
     if (method == null)
     {
         throw new ArgumentNullException(nameof(method));
     }
     Method    = method;
     Statement = statement;
 }
예제 #2
0
        /// <summary>
        /// Gets step ranges
        /// </summary>
        /// <param name="sourceStatement">Source statement</param>
        /// <returns></returns>
        public uint[] GetRanges(SourceStatement sourceStatement)
        {
            var list = new List <BinSpan>(GetUnusedBinSpans().Length + 1);

            list.Add(sourceStatement.BinSpan);
            list.AddRange(GetUnusedBinSpans());

            var orderedList = BinSpan.OrderAndCompactList(list);

            if (orderedList.Count == 0)
            {
                return(Array.Empty <uint>());
            }
            var binSpanArray = new uint[orderedList.Count * 2];

            for (int i = 0; i < orderedList.Count; i++)
            {
                binSpanArray[i * 2 + 0] = orderedList[i].Start;
                binSpanArray[i * 2 + 1] = orderedList[i].End;
            }
            return(binSpanArray);
        }
예제 #3
0
 /// <summary>
 /// Adds a <see cref="SourceStatement"/>
 /// </summary>
 /// <param name="statement">Statement</param>
 public void Add(SourceStatement statement) => statements.Add(statement);
예제 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="method">Method</param>
 /// <param name="statement">Statement</param>
 public MethodSourceStatement(MethodDef method, SourceStatement statement)
 {
     Method    = method ?? throw new ArgumentNullException(nameof(method));
     Statement = statement;
 }