Class InsideRequireOrAssert

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

public final class InsideRequireOrAssert extends Object implements Predicate<org.antlr.v4.runtime.tree.ParseTree>
True if the given parse node sits anywhere inside a 'require' or 'assert' statement.

Several PRE_IR code-smell checks (redundant empty/isSet checks, constant comparisons/coalescing, compound/flow conditions) suppress their diagnostic when the expression is a pre/post-condition, because there a deliberately-constant or always-true predicate is the point. This is the single home for that structural test - it was previously copy-pasted byte-for-byte across those checks.

  • Constructor Details

    • InsideRequireOrAssert

      public InsideRequireOrAssert()
  • Method Details

    • test

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