I added a stack of frames for local variables, and am looking up variables on that stack. Now, variables are local to the curly-brace block where they were defined (which has a name, which may aid debugging), they're looked up by most local to least local, and then in the global namespace (which is separate).
One way that this test had been failing was that the two different 'a' variables were getting confused, and the assignment "a=7" was stepping on the toplevel a, which should still have been 1. Now, everything's working correctly, and the assertions are happy.
Next up: being able to initialize variables at the time of declaration like "int x = 8;"
No comments:
Post a Comment