Exemple #1
0
        public static ImmutableArray <ValueType> ToLocals(BinaryReader reader, out uint length)
        {
            var locals      = new List <ValueType>();
            var localsCount = Values.UnsignedVar(reader, out var subLength);

            length = subLength;
            for (var i = 0; i < localsCount; i += 1)
            {
                var count = Values.UnsignedVar(reader, out subLength);
                length += subLength;
                var type = TypeParser.ToValueType(reader, out subLength);
                length += subLength;
                locals.AddRange(Enumerable.Repeat(type, (int)count));
            }
            return(locals.ToImmutableArray());
        }