Handling function arguments without macros.

I'm making a language that compiles to mcfunction files and I can't find a way to perfectly implement function arguments without using function macros. What I've tried so far is just defining the argument as a unique non-accessable variable name so that you can't access it out of the function. But this breaks when you call the function itself inside the function. Here's an example:

function test(a) {
   if (a == 2) return // Doesn't matter what it does when a=2, the point is that a=2 is executed.
   test(2) // since this uses the same `a` variable it will alter the value of `a`, making a = 2
   return a // returns 2 instead of 1
}

test(1) // returns 2 instead of 1

Is it possible to convert this code into mcfunction files?

Continue to help post