Correctly handle redeclarations - do not redeclare if in same context

Authored by ematirov on Aug 16 2017, 6:44 PM.