Ejemplo n.º 1
0
        public static Export ToExport(BinaryReader reader)
        {
            var name         = Values.ToName(reader);
            var externalKind = TypeParser.ToExternalKind(reader);
            var index        = Values.ToUInt(reader);

            return(new Export(name, externalKind, index));
        }
Ejemplo n.º 2
0
        public void ParseCustom(BinaryReader reader)
        {
            var name = Values.ToName(reader);

            using (var ms = new MemoryStream())
            {
                reader.BaseStream.CopyTo(ms);
                Custom = Custom.Add(name, ms.ToArray().ToImmutableArray());
            }
        }
Ejemplo n.º 3
0
        public static Import ToImport(BinaryReader reader)
        {
            var module = Values.ToName(reader);
            var name   = Values.ToName(reader);
            var type   = TypeParser.ToExternalKind(reader);

            switch (type)
            {
            case Types.ExternalKind.Function:
                return(new Import(module, name, Values.ToUInt(reader)));

            case Types.ExternalKind.Table:
                return(new Import(module, name, TypeParser.ToTableType(reader)));

            case Types.ExternalKind.Memory:
                return(new Import(module, name, TypeParser.ToMemoryType(reader)));

            case Types.ExternalKind.Global:
                return(new Import(module, name, TypeParser.ToGlobalType(reader)));

            default:
                throw new NotImplementedException();
            }
        }