More propagation of numeric types (#6177)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-04-07 19:02:41 +12:00
committed by GitHub
parent bc22d888ee
commit be05dd7ba1
24 changed files with 631 additions and 350 deletions

View File

@ -22,6 +22,8 @@ use crate::{
CompilationError,
};
use super::types::NumericType;
/// State for executing a program.
#[derive(Debug, Clone)]
pub struct ExecState {
@ -228,6 +230,13 @@ impl ExecState {
self.global.module_infos.insert(id, module_info);
}
pub fn current_default_units(&self) -> NumericType {
NumericType::Default {
len: self.length_unit(),
angle: self.angle_unit(),
}
}
pub fn length_unit(&self) -> UnitLen {
self.mod_local.settings.default_length_units
}