Exemplo n.º 1
0
 public static NativeNameKind ReadNameKind(this IBulkReader reader) => (NativeNameKind)reader.ReadInt32();
Exemplo n.º 2
0
 public static NativeSymbolKind ReadSymbolKind(this IBulkReader reader) => (NativeSymbolKind)reader.ReadInt32();
Exemplo n.º 3
0
        private NativeType ImportTypeReference()
        {
            var kind = _reader.ReadSymbolKind();

            switch (kind)
            {
            case NativeSymbolKind.ArrayType:
            {
                var elementCount = _reader.ReadInt32();
                var type         = ImportTypeReference();
                return(new NativeArray(type, elementCount));
            }

            case NativeSymbolKind.PointerType:
            {
                return(new NativePointer(ImportTypeReference()));
            }

            case NativeSymbolKind.BuiltinType:
            {
                var bt = (BuiltinType)_reader.ReadInt32();
                return(new NativeBuiltinType(bt));
            }

            case NativeSymbolKind.BitVectorType:
            {
                var count = _reader.ReadInt32();
                return(new NativeBitVector(count));
            }

            case NativeSymbolKind.NamedType:
            {
                var qualification = _reader.ReadString();
                var name          = _reader.ReadString();
                var isConst       = _reader.ReadBoolean();
                return(new NativeNamedType(qualification: qualification, name: name, isConst: isConst));
            }

            case NativeSymbolKind.OpaqueType:
            {
                return(new NativeOpaqueType());
            }

            default:
                throw Contract.CreateInvalidEnumValueException(kind);
            }
        }