Issue #514 : Fix compileRegAssignment cardinality
Fixes #514
Changes proposed in this pull request:
- In
compileRegAssignment, usenvarsas the assignment cardinality rather thanlennames. - Remove no-longer-used
namesargument
I don't really know what I'm doing, I just tried to infer what things were supposed to be doing based on their names. I started with the test case filed in #514 and compared with the behavior of official Lua 5.1. It turned out that luac has extra LOADNIL which reset the registers that weren't correctly reset by gopher-lua, so I poked around compileGenericForStmt and it took me a while to understand why the iteration variable names were fed to compileRegAssignment when its place in the code and the other arguments suggested it should be about initializing internal generator/state/control triplet rather than iteration variables.
I checked that after this change, the opcodes generated by gopher-lua are similar to those from luac, and the whole test suite passes.