public void Read(MethodSymbols symbols) { PdbFunction function; if (!functions.TryGetValue(symbols.MethodToken.ToUInt32(), out function)) { return; } ReadSequencePoints(function, symbols); ReadLocals(function.scopes, symbols); if (!string.IsNullOrEmpty(function.iteratorClass)) { symbols.IteratorType = function.iteratorClass; } if (function.iteratorScopes != null) { foreach (Microsoft.Cci.ILocalScope scope in function.iteratorScopes) { RangeSymbol range = new RangeSymbol(); range.start = (int)scope.Offset; range.end = (int)(scope.Offset + scope.Length); symbols.IteratorScopes.Add(range); } } }
/// <summary> /// Decodes a symbol using the <paramref name="coder"/> with the provided /// <paramref name="model"/>. /// </summary> public static TSymbolType Decode <TSymbolType>(this ArithmeticCoder coder, IModel <TSymbolType> model, ReadBitDelegate bitReader) where TSymbolType : struct { // read value uint value = coder.DecodeTarget(model.TotalFrequencies); // determine symbol RangeSymbol <TSymbolType> rangeSymbol = model.Decode(value); // adapt decoder coder.Decode(rangeSymbol.Range, bitReader); // update model model.Update(rangeSymbol.Symbol); return(rangeSymbol.Symbol); }