GROOVY-6873: Fix variable scope not popped when a variable is found to be a parameter