diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-24 15:41:22 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-24 15:41:22 +0100 |
| commit | e611f38c9d056da01b2cc3a532f9013ad1ee567a (patch) | |
| tree | 4a04f1431d6c98409fd97669d5a61560b358bec9 /lib/xixanta/src/errors.rs | |
| parent | 58d60e0d290ec50d7cda76e6509676f85e547c26 (diff) | |
| download | tools.nes-e611f38c9d056da01b2cc3a532f9013ad1ee567a.tar.gz tools.nes-e611f38c9d056da01b2cc3a532f9013ad1ee567a.zip | |
Fix usage of labels inside of macros
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à <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/errors.rs')
| -rw-r--r-- | lib/xixanta/src/errors.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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<ContextError> for Vec<Error> { + fn from(err: ContextError) -> Self { + vec![Error::Context(err)] + } +} + +impl From<EvalError> for Vec<Error> { + 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 { |
