AST::set_source affects internal module id

This commit is contained in:
Ilya Lakhin 2021-01-03 09:03:41 +07:00
parent ef48f47b74
commit acbf5d8723

View File

@ -224,7 +224,11 @@ impl AST {
/// Set the source. /// Set the source.
#[inline(always)] #[inline(always)]
pub fn set_source<S: Into<ImmutableString>>(&mut self, source: Option<S>) { pub fn set_source<S: Into<ImmutableString>>(&mut self, source: Option<S>) {
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. /// Get the statements.
#[cfg(not(feature = "internals"))] #[cfg(not(feature = "internals"))]