Changed ScopingRule to deal with scala scopes

After discussion with @Lewix, we realized we had no mechanism to deal with scala-style symbol scoping, so the ScopingRule base-type now provides symbol scoping functionalities.

I also extended the optimizer macro with ClassDef and ModuleDef since some rules were throwing warnings about this.
Well, I don't think you'd want to enterScope() and directly add to it. If you do this, your element will simply be scoped inside its current children. Also, masking will be performed in the same scope instead of children scope masking parent scopes. I can add the `this` return, it if you really feel it's a feature, but I think it might lead to confusion.

Changing `scope` sounds good, but `add` isn't really clear I feel. It sounds like you could be adding warnings or something. Maybe `addToScope` or `extendScope`?