From 2034ddd830f1752285f07064a3c2720f35eb4b14 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Thu, 20 Apr 2023 22:45:30 +0800 Subject: [PATCH] Fix builds. --- src/parser.rs | 18 +++++++----------- src/types/scope.rs | 2 ++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index d512cbad..4def8a60 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -2974,18 +2974,13 @@ impl Engine { let stack = state.stack.as_mut().unwrap(); let existing = if !hit_barrier && existing > 0 { - let offset = stack.len() - existing; - - if !stack.get_entry_by_index(offset).2.is_empty() { + match stack.len() - existing { // Variable has been aliased - None - } else { - if offset < state.block_stack_len { - // Defined in parent block - None - } else { - Some(offset) - } + #[cfg(not(feature = "no_module"))] + offset if !stack.get_entry_by_index(offset).2.is_empty() => None, + // Defined in parent block + offset if offset < state.block_stack_len => None, + offset => Some(offset), } } else { None @@ -2999,6 +2994,7 @@ impl Engine { None }; + #[cfg(not(feature = "no_module"))] if is_export { stack.add_alias_by_index(stack.len() - 1, name.clone()); } diff --git a/src/types/scope.rs b/src/types/scope.rs index 22626d02..a8252643 100644 --- a/src/types/scope.rs +++ b/src/types/scope.rs @@ -641,6 +641,8 @@ impl Scope<'_> { /// /// Panics if the index is out of bounds. #[inline(always)] + #[must_use] + #[allow(dead_code)] pub(crate) fn get_entry_by_index( &mut self, index: usize,