This is not a bug in dofile, it is just how listcode works: it returns a table
containing the bytecode for a function. In the case of chunks, the function
is the top-level, "main" function.
For a recursive (and nicer) listing of a chunk and its functions, use luac.
listcode is for internal debugging only.