This change moves the SymbolBodies with isLocal() == true before the global symbols then calculating NumLocals rather than assuming all locals are added before globals and the first NumLocals have isLocal() == true.
This permits the thunk creation code, that generates local symbols, to be moved after the pass that adds global symbols from synthetics to the symbol table.