Ejemplo n.º 1
0
        public ManagedBinaryWriter(ISymbolTable[] importedTables)
        {
            //raw writers and their buffers
            var lengthWriterBuffer = new PagedWriter256Buffer();
            var lengthSegment      = new List <Memory <byte> >(2);

            _symbolsWriter = new RawBinaryWriter(lengthWriterBuffer, new PagedWriter256Buffer(), lengthSegment);
            _userWriter    = new RawBinaryWriter(lengthWriterBuffer, new PagedWriter256Buffer(), lengthSegment);

            _importContext = new ImportedSymbolsContext(importedTables);
            _locals        = new Dictionary <string, int>();
        }
Ejemplo n.º 2
0
        public ManagedBinaryWriter(Stream outputStream, ISymbolTable[] importedTables)
        {
            if (!outputStream.CanWrite)
            {
                throw new ArgumentException("Output stream must be writable", nameof(outputStream));
            }

            _outputStream = outputStream;
            //raw writers and their buffers
            var lengthWriterBuffer = new PagedWriter256Buffer();
            var lengthSegment      = new List <Memory <byte> >(2);

            _symbolsWriter = new RawBinaryWriter(lengthWriterBuffer, new PagedWriter256Buffer(), lengthSegment);
            _userWriter    = new RawBinaryWriter(lengthWriterBuffer, new PagedWriter256Buffer(), lengthSegment);

            _importContext = new ImportedSymbolsContext(importedTables);
            _locals        = new Dictionary <string, int>();
        }