From acbf5d8723ad11187a3279c873deab849add1ec5 Mon Sep 17 00:00:00 2001 From: Ilya Lakhin Date: Sun, 3 Jan 2021 09:03:41 +0700 Subject: [PATCH] AST::set_source affects internal module id --- src/ast.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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"))]