diff --git a/src/ast.rs b/src/ast.rs index 743ba661..fafc4394 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -224,7 +224,11 @@ impl AST { /// Set the source. #[inline(always)] pub fn set_source>(&mut self, source: Option) { - self.source = source.map(|s| s.into()) + self.source = source.map(|s| s.into()); + + if let Some(module) = Shared::get_mut(&mut self.functions) { + module.set_id(self.source.clone()); + } } /// Get the statements. #[cfg(not(feature = "internals"))]