(core) remove duplicate code in newTempLocalVariable