merge 5696:5698 from code completion branch. Fix locals resolution
Authored by: vincent_cave 2012-08-22
Parent: [r5698]
Child: [r5700]