nurpax / c64jasm

C64 6502 assembler in TypeScript
51 stars 14 forks source link

[bug] macro and label can't have the same name #74

Closed shazz closed 3 years ago

shazz commented 3 years ago

Example:

!macro do_something() {
    lda #1
}

+do_something()

do_something:
    lda #2

Error:

main.asm:7:1: error: Symbol 'do_something' already defined

Maybe this is by design, but doesn't look obvious to me as macro are prefixed by +

nurpax commented 3 years ago

I guess I'd go with just not allowing same names for labels, variables and macros in the same scope. Certainly for example in other language if you'd equate macros with functions, you can't generally have a name that's both a local variable and a function with.

image image

nurpax commented 3 years ago

I did have a bug w.r.t macro names. Fixed. Symbols with the same name should now always conflict regardless of their type.