From f0624b8929e6ead3f2d8b1939dc7f094c539bee1 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 5 Nov 2024 13:39:16 +0100 Subject: Re-work the handling of segments in the assembler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There were a lot of assumptions on the assembler that stemmed from a fundamental missunderstanding from my side on how segments are laid out on the final file. This commit is the first step to address this. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/context.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/xixanta/src/context.rs') diff --git a/lib/xixanta/src/context.rs b/lib/xixanta/src/context.rs index 683d750..000c959 100644 --- a/lib/xixanta/src/context.rs +++ b/lib/xixanta/src/context.rs @@ -124,6 +124,8 @@ impl Context { let scope_name = self.name().to_string(); let scope = self.labels.get_mut(&scope_name).unwrap(); + // println!("PUSHING: {:#?}", bundle); + scope.push(bundle.clone()); } @@ -274,7 +276,7 @@ impl Context { Ok(()) } - // Returns the name of the current context. + /// Returns the name of the current context. pub fn name(&self) -> &str { match self.stack.last() { Some(name) => name, @@ -282,6 +284,11 @@ impl Context { } } + /// Returns true if we are in the global scope. + pub fn is_global(&self) -> bool { + self.stack.is_empty() + } + // Returns a human-readable string representing the current context. fn to_human(&self) -> String { match self.stack.last() { -- cgit v1.2.3