libyul/backends/wasm/BinaryTransform.cpp
/// This is a kind of run-length-encoding of local types.
This is a kind of run-length-encoding of local types.
This is a kind of run - length - encoding of local types .
vector<pair<size_t, ValueType>> groupLocalVariables(vector<VariableDeclaration> _localVariables)
{
	vector<pair<size_t, ValueType>> localEntries;
	size_t entrySize = 0;
	ValueType entryType = ValueType::I32; 
	for (VariableDeclaration const& localVariable: _localVariables)
	{
		ValueType variableType = toValueType(localVariable.type);
		if (variableType != entryType)
		{
			if (entrySize > 0)
				localEntries.emplace_back(entrySize, entryType);
			entryType = variableType;
			entrySize = 0;
		}
		++entrySize;
	}
	if (entrySize > 0)
		localEntries.emplace_back(entrySize, entryType);
	return localEntries;
}
vector < pair < size_t , ValueType > > groupLocalVariables ( vector < VariableDeclaration > _localVariables ) { vector < pair < size_t , ValueType > > localEntries ; size_t entrySize = 0 ; ValueType entryType = ValueType :: I32 ; for ( VariableDeclaration const & localVariable : _localVariables ) { ValueType variableType = toValueType ( localVariable . type ) ; if ( variableType != entryType ) { if ( entrySize > 0 ) localEntries . emplace_back ( entrySize , entryType ) ; entryType = variableType ; entrySize = 0 ; } ++ entrySize ; } if ( entrySize > 0 ) localEntries . emplace_back ( entrySize , entryType ) ; return localEntries ; }
This is a kind of run-length-encoding of local types.
This is a kind of run - length - encoding of local types .
// Any type would work here