mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 05:43:53 +01:00
bugfix, functions added via config have bad infos
functions added to a Config may have `info::neverused()` as their info, which also makes the DisplayInfo part of the info not work, which can be a problem if the function uses its infos to define object fields or to format an object.
This commit is contained in:
parent
37f2e46d0c
commit
bdd7260c12
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mers_lib"
|
||||
version = "0.9.6"
|
||||
version = "0.9.7"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "library to use the mers language in other projects"
|
||||
|
@ -157,6 +157,20 @@ impl Config {
|
||||
val: Arc<RwLock<Data>>,
|
||||
val_type: crate::data::Type,
|
||||
) -> Self {
|
||||
// give the correct DisplayInfo to functions' inner scopes.
|
||||
{
|
||||
let data = val.write().unwrap();
|
||||
let mut data = data.get_mut_unchecked();
|
||||
if let Some(f) = data.mut_any().downcast_mut::<data::function::Function>() {
|
||||
f.info.global.object_fields = Arc::clone(&self.info_check.global.object_fields);
|
||||
f.info.global.object_fields_rev =
|
||||
Arc::clone(&self.info_check.global.object_fields_rev);
|
||||
let mut info_check = f.info_check.lock().unwrap();
|
||||
info_check.global.object_fields = Arc::clone(&self.info_check.global.object_fields);
|
||||
info_check.global.object_fields_rev =
|
||||
Arc::clone(&self.info_check.global.object_fields_rev);
|
||||
}
|
||||
}
|
||||
self.info_parsed.scopes[0].init_var(name, (0, self.globals));
|
||||
self.info_run.scopes[0].init_var(self.globals, val);
|
||||
self.info_check.scopes[0].init_var(self.globals, val_type);
|
||||
|
Loading…
Reference in New Issue
Block a user