lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> In lparser.c function `singlevar()` it checks that the `ls->envn`
> named variable (i.e. _ENV) is initialised to a VLOCAL or VUPVAL, but
> the `singlevaraux()` function may return VVOID without ever
> initialising the `var->k` value.  The assert should be instead that
> `singlevaraux()` doesn't return VVOID.

We cannot put the call inside the assert, so we need to assign
the return to a variable and assert on that variable. But without
assertions, we get a "unused variable" warning (and a weird code).  Then
we add a "(void)var" to avoid the warning, and get weirder code.  All in
all, the current assertion documents what we want and keeps the regular
code simple. (After all, if the assertion holds, its code is correct ;-)

-- Roberto