Fix vector element assignment issues

This commit is contained in:
Jason Turner
2015-10-15 21:20:12 -06:00
parent b11ebf9e8f
commit 36765df3c0
5 changed files with 17 additions and 13 deletions

View File

@@ -470,6 +470,7 @@ namespace chaiscript
m->add(fun(&Boxed_Value::is_type), "is_type");
m->add(fun(&Boxed_Value::get_attr), "get_var_attr");
m->add(fun(&Boxed_Value::copy_attrs), "copy_var_attrs");
m->add(fun(&Boxed_Value::clone_attrs), "clone_var_attrs");
m->add(fun(&Boxed_Value::get_type_info), "get_type_info");
m->add(user_type<Type_Info>(), "Type_Info");

View File

@@ -297,6 +297,13 @@ namespace chaiscript
return *this;
}
Boxed_Value &clone_attrs(const Boxed_Value &t_obj)
{
copy_attrs(t_obj);
reset_return_value();
return *this;
}
/// \returns true if the two Boxed_Values share the same internal type
static bool type_match(const Boxed_Value &l, const Boxed_Value &r) CHAISCRIPT_NOEXCEPT

View File

@@ -1031,13 +1031,7 @@ namespace chaiscript
uint_fast32_t loc = t_loc.load(std::memory_order_relaxed);
const auto funs = get_function(t_name, loc);
if (funs.first != loc) t_loc.store(uint_fast32_t(funs.first), std::memory_order_relaxed);
Boxed_Value bv = dispatch::dispatch(*funs.second, params, m_conversions);
// the result of a clone is never to be marked as a return_value
// \todo see if we can eliminate this comparison
if (t_name == "clone") {
bv.reset_return_value();
}
return bv;
return dispatch::dispatch(*funs.second, params, m_conversions);
}