Changed ScopingRule to deal with scala scopes and extended optimizing
macro to ClassDef and ModuleDef