Example #1
0
        /// <summary>
        /// Creates a new local value of the specified type and returns its value index.
        /// </summary>
        public ushort AddLocal(TypeDefinition type, LocalFlags flags)
        {
            if (_values.Count == ushort.MaxValue)
            {
                throw new IndexOutOfRangeException("Out of local indices");
            }

            _values.Add(new LocalValue(type, flags));
            return((ushort)(_values.Count - 1));
        }
Example #2
0
        internal override void Deserialize(IDefinitionReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            var type         = reader.ReadReference <NativeDefinition>();
            var flags        = (LocalFlags)reader.ReadValueU8();
            var unknownFlags = flags & ~KnownFlags;

            if (unknownFlags != LocalFlags.None)
            {
                throw new FormatException();
            }

            this.Type  = type;
            this.Flags = flags;
        }
Example #3
0
 public LocalValue(TypeDefinition type, LocalFlags flags)
 {
     Type  = type;
     Flags = flags;
 }