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.
Unfotunately, yes. Unless the user isn't interested in block scoping in certain cases, which could happen, I guess. We could change this by making the optimizing macro composable and changing the abstract step function in ScopingRule to something other than `step`, but I'm not sure how clear this would be.

I feel like writing enterScope() on blocks is not a heavy price for  clarity and flexibility. Especially since we probably won't have that many rules that rely on this functionality as it's only necessary for masking detection.