Sha256: ff3ac362dc04ce64ae49983e9cad32c5ef28b9e6eb557db51096fcc3743384f1

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

/* Copyright (c) 2024 Julian Benda
 *
 * This file is part of inkCPP which is released under MIT license.
 * See file LICENSE.txt or go to
 * https://github.com/JBenda/inkcpp for full license details.
 */
#include "emitter.h"

namespace ink::compiler::internal
{
	void emitter::start(int ink_version, compilation_results* results)
	{
		// store
		_ink_version = ink_version;
		set_results(results);

		// reset
		_container_map.clear();
		_max_container_index = 0;

		// initialize
		initialize();
	}

	void emitter::finish(container_t max_container_index)
	{
		// store max index
		_max_container_index = max_container_index;

		// finalize
		finalize();
	}

	void emitter::add_start_to_container_map(uint32_t offset, container_t index)
	{
		if (_container_map.rbegin() != _container_map.rend())
		{
			if (_container_map.rbegin()->first > offset)
			{
				warn() << "Container map written out of order. Wrote container at offset "
					<< offset << " after container with offset " << _container_map.rbegin()->first << std::flush;
			}
		}

		_container_map.push_back(std::make_pair(offset, index));
		setContainerIndex(index);
	}

	void emitter::add_end_to_container_map(uint32_t offset, container_t index)
	{
		if (_container_map.rbegin() != _container_map.rend())
		{
			if (_container_map.rbegin()->first > offset)
			{
				warn() << "Container map written out of order. Wrote container at offset "
					<< offset << " after container with offset " << _container_map.rbegin()->first << std::flush;
			}
		}

		_container_map.push_back(std::make_pair(offset, index));
	}
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inkcpp_rb-0.1.3 ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.cpp
inkcpp_rb-0.1.2 ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.cpp
inkcpp_rb-0.1.1 ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.cpp
inkcpp_rb-0.1.0 ext/inkcpp_rb/inkcpp/inkcpp_compiler/emitter.cpp