Enable modifying constant shared values.
This commit is contained in:
@@ -250,7 +250,15 @@ impl Engine {
|
||||
|
||||
let var_name = lhs.get_variable_name(false).expect("`Expr::Variable`");
|
||||
|
||||
if !lhs_ptr.is_ref() {
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
// Temp results from expressions are flattened so should never be shared.
|
||||
// A shared value may be provided by a variable resolver, however.
|
||||
let is_temp_result = !lhs_ptr.is_ref() && !lhs_ptr.is_shared();
|
||||
#[cfg(feature = "no_closure")]
|
||||
let is_temp_result = !lhs_ptr.is_ref();
|
||||
|
||||
// Cannot assign to temp result from expression
|
||||
if is_temp_result {
|
||||
return Err(
|
||||
ERR::ErrorAssignmentToConstant(var_name.to_string(), pos).into()
|
||||
);
|
||||
@@ -950,7 +958,7 @@ impl Engine {
|
||||
if !export.is_empty() {
|
||||
if !module.is_indexed() {
|
||||
// Index the module (making a clone copy if necessary) if it is not indexed
|
||||
let mut m = crate::func::native::shared_take_or_clone(module);
|
||||
let mut m = crate::func::shared_take_or_clone(module);
|
||||
m.build_index();
|
||||
global.push_import(export.name.clone(), m);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user