From e611f38c9d056da01b2cc3a532f9013ad1ee567a Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 24 Dec 2024 15:41:22 +0100 Subject: Fix usage of labels inside of macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of calling `evaluate_node` for each node on a macro, just call `Assembler::bundle` for the list of nodes so the context is preserved and labels and other statements can be catched as usual. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/errors.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/xixanta/src/errors.rs') diff --git a/lib/xixanta/src/errors.rs b/lib/xixanta/src/errors.rs index 4dcdc23..ae55b83 100644 --- a/lib/xixanta/src/errors.rs +++ b/lib/xixanta/src/errors.rs @@ -7,6 +7,18 @@ pub enum Error { Eval(EvalError), } +impl From for Vec { + fn from(err: ContextError) -> Self { + vec![Error::Context(err)] + } +} + +impl From for Vec { + fn from(err: EvalError) -> Self { + vec![Error::Eval(err)] + } +} + impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { -- cgit v1.2.3