Пример #1
0
	/// \brief Implementation of types::NormalizeFunction::execute(const types::Variant&)const
	types::Variant execute( const types::Variant& i) const
	{
		types::Variant rt( m_type, m_initializer);
		if (i.defined())
		{
			rt.data().value.Custom->assign( i);
		}
		return rt;
	}
Пример #2
0
void StructureBuilder::setValue( const types::Variant& value_)
{
	LOG_DATA << "[mylang structure builder] set value '" << value_.tostring() << "'";
	if (!m_stk.back().get())
	{
		m_stk.back().reset( new Structure());
	}
	if (!value_.defined()) throw std::runtime_error("set undefined value");
	if (m_stk.back()->m_value.defined()) throw std::runtime_error("value already defined");
	if (!m_stk.back()->m_struct.empty()) throw std::runtime_error("setValue for atomic value called for a structure");
	m_stk.back()->m_value = value_;
}