Class OwnedDeclaration

java.lang.Object
org.ek9lang.compiler.phase7.generator.OwnedDeclaration

public final class OwnedDeclaration extends Object
THE declaration of a variable that owns the temporaries its initialiser makes (OPS-6): a returning variable (<- rtn as String: String()) and a property (name as String: String()) are declared by no block statement, so the declaration itself closes the closeable temporaries its initialiser creates (StatementOwnedCloseables). A declaration with no initialiser makes none, so it is declared plainly. Returning-variable processing, operation bodies and property initialisers all declare through here - never re-spell the variableDeclaration / variableOnlyDeclaration choice.
  • Constructor Details

    • OwnedDeclaration

      OwnedDeclaration(GeneratorSet generators)
  • Method Details

    • declare

      public List<IRInstr> declare(org.antlr.v4.runtime.ParserRuleContext owner, EK9Parser.VariableDeclarationContext variableDeclaration, EK9Parser.VariableOnlyDeclarationContext variableOnlyDeclaration)
      Declare whichever of the two forms is present; nothing when neither is.
      Parameters:
      owner - The construct that owns the initialiser's temporaries.
      variableDeclaration - The declaration with an initialiser, or null.
      variableOnlyDeclaration - The declaration without an initialiser, or null.
      Returns:
      The declaration's instructions.