diff options
| author | Ben Bridle <ben@derelict.engineering> | 2025-12-04 16:59:53 +1300 |
|---|---|---|
| committer | Ben Bridle <ben@derelict.engineering> | 2025-12-04 17:03:55 +1300 |
| commit | 29e847768ae5d6fe7e631c668d23536729dbe8d8 (patch) | |
| tree | 086c87275471118cba2b939382230ce08618fc1b /src | |
| parent | 938b40dd15f1d44f8881261a64e092fc0fd9165b (diff) | |
| download | torque-asm-main.zip | |
This commit includes the arity of a parent macro in the namespace
of a macro argument, so that the assembler library can recognise that
two macro implementations with different arities are not the same.
This fixes an error where two implementations of a macro with the same
name but different arity could not share argument names, because the
arity of the parent macro wasn't being taken into account when checking
for redefinitions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/stages/compiler.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/stages/compiler.rs b/src/stages/compiler.rs index bc86589..4777fb4 100644 --- a/src/stages/compiler.rs +++ b/src/stages/compiler.rs @@ -119,7 +119,9 @@ impl SymbolParser { SymbolRoleDetailed::MacroDefinition, ); // Track that we're currently inside a macro definition. - self.macro_name = Some(definition.name.to_string()); + let macro_name = &definition.name; + let macro_args = definition.arguments.len(); + self.macro_name = Some(format!("{macro_name}::{macro_args}")); for argument in &definition.arguments { self.record_symbol( |
