move a variable declaration to the beginning of a block