Improvements to shadowing logic.

Recognizes pattern variables as bindingOccurences
and adds deepCopy method to ast.
Removes some dead code from util.