Class AbstractSafeGenericAccessMarker

java.lang.Object
org.ek9lang.compiler.phase5.AbstractSafeGenericAccessMarker
Direct Known Subclasses:
ForLoopSafeGenericAccessMarker, IfBlockSafeGenericAccessMarker, SwitchBlockSafeGenericAccessMarker, TernaryBlockSafeGenericAccessMarker, TryBlockSafeGenericAccessMarker, WhileLoopSafeGenericAccessMarker

abstract class AbstractSafeGenericAccessMarker extends Object
Does checks on the control part of a while loop to see if Optional/Result/Iterator are now safe via method access.
  • Field Details

  • Constructor Details

    • AbstractSafeGenericAccessMarker

      AbstractSafeGenericAccessMarker(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener)
      Constructor to provided typed access.
  • Method Details

    • processPreFlow

      protected void processPreFlow(EK9Parser.PreFlowStatementContext ctx, IScope wouldBeSafeScope)
      The pre-flow's subject is safe in the construct ONLY when the pre-flow is a guard that skips the construct when the subject is unset (<-, :=? - PreFlowCanSkipBody). A plain := checks nothing: if o := empty() then gate ran its body with an empty o and o.get() threw. Before marking, a pre-flow that re-points a subject the scope AROUND the construct has already proven safe is E08040 - judged here, because the construct's own marking would hide it.
    • processExpression

      protected void processExpression(EK9Parser.ExpressionContext ctx, IScope wouldBeSafeScope)
      Each top-level and conjunct of the control that is an is-set check proves its subject safe in wouldBeSafeScope, whatever the other conjuncts are (SafeAccessConjuncts, decision Q3).