Class VisibilityChangePredicate
change_visibility refactoring.
Reuses MethodAccessModifierRules (the same rule core the compiler enforces in
VisibilityOfOperationsOrError) so the predicate can never drift from what the compiler
accepts, and layers on the rules that live in other phases: a no-op change, the
fields/operators-have-no-modifier facts (grammar), and the override lock
(E07010 forbids private; E05130 forces an override to match its parent's modifier - so an
override's visibility cannot change at all).
Intended to be shared by the compiler-services MCP ek9_change_visibility tool and the IDE
Refactor menu (which should not offer the option when it is not viable).
NOTE - this is purely structural. It does NOT check whether narrowing visibility would leave existing call sites unable to reach the member (E06180 NOT_ACCESSIBLE); that reference-graph "narrowing safety" check belongs to the tool's apply / dry-run path.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
VisibilityChangePredicate
public VisibilityChangePredicate()
-
-
Method Details
-
canChangeTo
- Parameters:
member- the member whose visibility a change is proposed fortargetAccessModifier- the proposed access modifier ("public" / "protected" / "private")- Returns:
- whether the change is structurally possible, with a reason when not
-