mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
add compile_mut and check_mut
This commit is contained in:
parent
f2aad4215c
commit
1e658805d1
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mers_lib"
|
name = "mers_lib"
|
||||||
version = "0.7.1"
|
version = "0.7.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
description = "library to use the mers language in other projects"
|
description = "library to use the mers language in other projects"
|
||||||
|
@ -30,13 +30,25 @@ pub fn compile(
|
|||||||
statement: &(impl program::parsed::MersStatement + ?Sized),
|
statement: &(impl program::parsed::MersStatement + ?Sized),
|
||||||
mut info: crate::program::parsed::Info,
|
mut info: crate::program::parsed::Info,
|
||||||
) -> Result<Box<dyn program::run::MersStatement>, CheckError> {
|
) -> Result<Box<dyn program::run::MersStatement>, CheckError> {
|
||||||
statement.compile(&mut info, CompInfo::default())
|
compile_mut(statement, &mut info)
|
||||||
|
}
|
||||||
|
pub fn compile_mut(
|
||||||
|
statement: &(impl program::parsed::MersStatement + ?Sized),
|
||||||
|
info: &mut crate::program::parsed::Info,
|
||||||
|
) -> Result<Box<dyn program::run::MersStatement>, CheckError> {
|
||||||
|
statement.compile(info, CompInfo::default())
|
||||||
}
|
}
|
||||||
pub fn check(
|
pub fn check(
|
||||||
statement: &(impl program::run::MersStatement + ?Sized),
|
statement: &(impl program::run::MersStatement + ?Sized),
|
||||||
mut info: crate::program::run::CheckInfo,
|
mut info: crate::program::run::CheckInfo,
|
||||||
) -> Result<Type, CheckError> {
|
) -> Result<Type, CheckError> {
|
||||||
let o = statement.check(&mut info, None)?;
|
check_mut(statement, &mut info)
|
||||||
|
}
|
||||||
|
pub fn check_mut(
|
||||||
|
statement: &(impl program::run::MersStatement + ?Sized),
|
||||||
|
info: &mut crate::program::run::CheckInfo,
|
||||||
|
) -> Result<Type, CheckError> {
|
||||||
|
let o = statement.check(info, None)?;
|
||||||
let mut err = None;
|
let mut err = None;
|
||||||
for (try_stmt, used) in info.global.unused_try_statements.lock().unwrap().iter() {
|
for (try_stmt, used) in info.global.unused_try_statements.lock().unwrap().iter() {
|
||||||
if used.iter().any(|v| v.is_some()) {
|
if used.iter().any(|v| v.is_some()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user