mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-31 09:56:19 +01:00
improve error messages
- fix bug where `thread` function wouldn't error when being called on a non-function - add compile error when a function in `try` is never used, because this is almost certainly a mistake and will cause mers to unexpectedly go down the "wrong" code path. - some small changes so mers_lib can be used in another project
This commit is contained in:
@@ -84,11 +84,19 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_var(mut self, name: String, val: Data) -> Self {
|
||||
pub fn add_var(self, name: String, val: Data) -> Self {
|
||||
let t = val.get().as_type();
|
||||
self.add_var_arc(name, Arc::new(RwLock::new(val)), t)
|
||||
}
|
||||
pub fn add_var_arc(
|
||||
mut self,
|
||||
name: String,
|
||||
val: Arc<RwLock<Data>>,
|
||||
val_type: crate::data::Type,
|
||||
) -> Self {
|
||||
self.info_parsed.scopes[0].init_var(name, (0, self.globals));
|
||||
self.info_run.scopes[0].init_var(self.globals, Arc::new(RwLock::new(val)));
|
||||
self.info_check.scopes[0].init_var(self.globals, t);
|
||||
self.info_run.scopes[0].init_var(self.globals, val);
|
||||
self.info_check.scopes[0].init_var(self.globals, val_type);
|
||||
self.globals += 1;
|
||||
self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user