Resolution of conflicting labels

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Resolution of conflicting labels

cyboman
How do we resolve conflicting labels (labels with the same name) that are in two different files and are both outside of the functions?

Example:
file1.vm
File1.myfunction 0
...
return
(MYLABEL)
...

file2.vm
File2.myfunction 0
...
return
(MYLABEL)

A case with a label outside the function can be found in the FunctionCalls/FibonacciElement/Main.vm.
...
Reply | Threaded
Open this post in threaded view
|

Re: Resolution of conflicting labels

cadet1620
Administrator
Everything in a .VM file after a function command belongs to that function, up to the next function or the end of the file.

In the case of FibonacciElement/Main.vm, the Main.fibonacci function has two places it can return depending on the argument value.

Although there should not be any goto or label statements before the first function, my VM translator initializes its functionName variable to the file name rather than to an empty string, just in case...

--Mark