Support use-strict by moving function def out of while loop