Class EnclosingOperation

java.lang.Object
org.ek9lang.compiler.support.EnclosingOperation

public final class EnclosingOperation extends Object
THE "which method or operator is this node directly in?" - the declaration whose code runs when this node runs.

The walk stops, with nothing, at the two places where code runs LATER than the construction or close that contains it: a dynamic function's body and an aggregate's parts (a dynamic class's methods). There this is another object or the construction is over, so the enclosing constructor or close operator is not the one that matters. The constructor rules (SelfReferenceStore.enclosingConstructor(ParseTree, SymbolsAndScopes)) and the close-operator rules (ObjectUsedBeforeConstructedOrError) each had this loop, one stopping at a method and one at an operator (front-end rationalisation C-11); they ask here and apply their own kind test to the declaration.

  • Method Summary

    Modifier and Type
    Method
    Description
    static Optional<org.antlr.v4.runtime.ParserRuleContext>
    of(org.antlr.v4.runtime.tree.ParseTree node)
    The nearest MethodDeclarationContext or OperatorDeclarationContext above the node, or empty when the node is in neither - or in code that runs later (see the class description).

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static Optional<org.antlr.v4.runtime.ParserRuleContext> of(org.antlr.v4.runtime.tree.ParseTree node)
      The nearest MethodDeclarationContext or OperatorDeclarationContext above the node, or empty when the node is in neither - or in code that runs later (see the class description).