improve support for #include in language server

This commit is contained in:
Mark
2023-12-06 18:58:10 +01:00
parent 2e6c6940d4
commit d3164254b3
3 changed files with 38 additions and 20 deletions

View File

@@ -27,8 +27,10 @@ impl MersStatement for IncludeMers {
info: &mut info::Info<super::Local>,
comp: CompInfo,
) -> Result<Box<dyn program::run::MersStatement>, CheckError> {
let mut inc_info = info.duplicate();
inc_info.global.enable_hooks = false;
let compiled: Arc<Box<dyn crate::program::run::MersStatement>> =
match self.include.compile(&mut info.duplicate(), comp) {
match self.include.compile(&mut inc_info, comp) {
Ok(v) => Arc::new(v),
Err(e) => {
return Err(CheckError::new()

View File

@@ -26,8 +26,11 @@ impl MersStatement for Chain {
if init_to.is_some() {
return Err("can't init to statement type Chain".to_string().into());
}
let prev_enable_hooks = info.global.enable_hooks;
info.global.enable_hooks = false;
let arg = self.first.check(info, None)?;
let func = self.chained.check(info, None)?;
info.global.enable_hooks = prev_enable_hooks;
let mut o = Type::empty();
for func in &func.types {
if let Some(func) = func