Address issues brought up in code review.

Renamed isParameterReferencedInBody to isParameterUsedInFunction.
Add test case.