Class IsAccessOnThis

java.lang.Object
org.ek9lang.compiler.phase5.IsAccessOnThis
All Implemented Interfaces:
Predicate<org.antlr.v4.runtime.tree.ParseTree>

final class IsAccessOnThis extends Object implements Predicate<org.antlr.v4.runtime.tree.ParseTree>
THE test, for cohesion (E11014), that a member access is made on the object itself rather than on another object. Only what an object does to itself joins its methods (Steve, 2026-11-11): a call or field read on another instance of the same class - other.m(), other.amount - is not an edge of the LCOM4 graph.

On the object itself is: a bare call m() or bare field amount, the first step of a chain that starts with this (this.m(), this.amount), and an operator expression whose receiver is this (this + other; for in the receiver is the right-hand side). Any later step of a chain is on whatever the step before it produced, so it is never on the object itself.

Whether the member belongs to the aggregate being measured is decided separately, by identity, in CohesionTracker (OwnProperty for a field); this test only reads the receiver from the parse tree. It is wider than PropertyAccessedDirectly, which accepts only a single-step this.prop: here the first step of this.prop.size() is still on the object itself.

  • Constructor Details

    • IsAccessOnThis

      IsAccessOnThis()
  • Method Details

    • test

      public boolean test(org.antlr.v4.runtime.tree.ParseTree node)
      Specified by:
      test in interface Predicate<org.antlr.v4.runtime.tree.ParseTree>