Fix scoping in functions

1. Fix variable scoping in member functions
2. Added testcases for local vars in member functions
3. Added negative testcases for local keyword