summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2025-02-10 12:56:31 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2025-02-10 12:56:45 +1300
commitd5f5489debcc23aebef31f13d92a6372dea1641d (patch)
tree5bdd52396294baab8aac2fb365347a8ea2a5e0d2 /src
parent8ddf72ad0252f17913540a2e767966899a29d1b6 (diff)
downloadassembler-d5f5489debcc23aebef31f13d92a6372dea1641d.zip
Definitions can only come from the same or a parent namespace
This commit fixes an error where a reference was being resolved by a definition in a child namespace.
Diffstat (limited to 'src')
-rw-r--r--src/source_unit.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/source_unit.rs b/src/source_unit.rs
index bc6d4ab..1581b58 100644
--- a/src/source_unit.rs
+++ b/src/source_unit.rs
@@ -119,6 +119,7 @@ impl Symbol {
/// True if this symbol is a valid definition for a reference symbol
pub fn defines(&self, reference: &Symbol) -> bool {
self.name == reference.name &&
+ self.namespace.len() <= reference.namespace.len() &&
std::iter::zip(&self.namespace, &reference.namespace).all(|(a, b)| a == b)
}
}