extract variable declaration to parent scope