Class DeclarationScope

Direct Known Subclasses:
BlockDeclaration, ConnectionBlock, Thunk

public abstract class DeclarationScope extends Declaration

Declaration Scope.

This class is prefix to BlockDeclaration and ConnectionBlock, and superclass of ClassDeclaration, ProcedureDeclaration and MaybeBlockDeclaration.

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
  • Field Details

    • sourceFileName

      public String sourceFileName
      The source file name.
    • sourceBlockLevel

      public int sourceBlockLevel
      The source block level. Set during Parsing.
    • hasLocalClasses

      public boolean hasLocalClasses
      Indicate if this scope has local classes.
    • isPreCompiledFromFile

      public String isPreCompiledFromFile
      If not null; this Class/Procedure is Pre-Compiled from a .jar file
    • declarationList

      public DeclarationList declarationList
      The declaration list.
    • labelList

      public LabelList labelList
      The label list.
    • CLASSFILE_ALREADY_GENERATED

      protected boolean CLASSFILE_ALREADY_GENERATED
      Indicator used to prevent multiple ClassFile generation. This situation may occur during the class body concatenation process.
  • Constructor Details

    • DeclarationScope

      protected DeclarationScope(String ident)
      Create a new DeclarationScope.
      Parameters:
      ident - scope identifier
  • Method Details

    • modifyIdentifier

      protected void modifyIdentifier(String newIdentifier)
      Modify the identifier of this class, procedure, ...
      Parameters:
      newIdentifier - the new identifier
    • edJavaClassName

      protected String edJavaClassName()
      Utility to edit JavaClass'Name
      Returns:
      the edited JavaClass'Name
    • getRTBlockLevel

      public int getRTBlockLevel()
      Utility: Get Runtime BlockLevel.
      Returns:
      true: the Runtime BlockLevel.
    • scopeID

      public String scopeID()
      Returns a printable scope ID.
      Returns:
      a printable scope ID
    • prefixLevel

      public int prefixLevel()

      Returns the prefix level.

      Redefined in ClassDeclaration

      Returns:
      the prefix level
    • findVisibleAttributeMeaning

      public Meaning findVisibleAttributeMeaning(String ident)
      Find visible attribute's Meaning
      Parameters:
      ident - attribute identifier
      Returns:
      the resulting Meaning
    • findMeaning

      public Meaning findMeaning(String identifier)
      Find Meaning
      Parameters:
      identifier - declared identifier
      Returns:
      the resulting Meaning
    • findLabelMeaning

      public Meaning findLabelMeaning(String identifier)
      Find Label's Meaning
      Parameters:
      identifier - declared label identifier
      Returns:
      the resulting Meaning
    • findProcedure

      public ProcedureDeclaration findProcedure(String identifier)
      Follow Static Chain Looking for a Procedure named 'identifier'
      Parameters:
      identifier - the procedure identifier
      Returns:
      the resulting ProcedureDeclaration
    • edCTX

      public String edCTX()
      ClassFile coding utility: Edit current context chain.
      Returns:
      edited context chain
    • edCTX

      public static String edCTX(int ctxDiff)
      ClassFile coding utility: Edit context chain.
      Parameters:
      ctxDiff - block level difference.
      Returns:
      edited context chain
    • buildCTX

      public boolean buildCTX(CodeBuilder codeBuilder)
      ClassFile coding utility: Build current context chain.
      Parameters:
      codeBuilder - the codeBuilder to use.
      Returns:
      true: if resulting field need a cast.
    • buildCTX

      public boolean buildCTX(int corr, CodeBuilder codeBuilder)
      ClassFile coding utility: Build current context chain.
      Parameters:
      corr - correction .
      codeBuilder - the codeBuilder to use.
      Returns:
      true: if resulting field need a cast.
    • buildCTX2

      public static boolean buildCTX2(int ctxDiff, CodeBuilder codeBuilder)
      ClassFile coding utility: Build context chain.
      Parameters:
      ctxDiff - block level difference.
      codeBuilder - the codeBuilder to use.
      Returns:
      true: if resulting field need a cast.
    • edScopeChain

      public String edScopeChain()
      Edit scope chain.
      Returns:
      edited scope chain
    • getClassDesc

      public ClassDesc getClassDesc()
      Return the ClassDesc
      Returns:
      the ClassDesc
    • printStaticChain

      public void printStaticChain(String title, int details)
      Debug utility: printStaticChain
      Parameters:
      title - title String
      details - level of details
    • printDeclarationList

      protected void printDeclarationList(int indent)
      Debug utility: print DeclarationList.
      Parameters:
      indent - the indentation.
    • edScope

      public String edScope()
      Debug utility: edScope
      Returns:
      edited scope String
    • buildClassFile

      public abstract byte[] buildClassFile()
      Build Class File
      Returns:
      Class File bytes
    • createJavaClassFile

      public void createJavaClassFile() throws IOException
      Create Java ClassFile.
      Throws:
      IOException - if something went wrong.
    • buildAndLoadOrAddClassFile

      protected void buildAndLoadOrAddClassFile() throws IOException
      Redefined in ClassDeclaration
      Throws:
      IOException - if something went wrong.
    • doBuildClassFile

      protected byte[] doBuildClassFile()
      Build ClassFile.
      Returns:
      ClassFile bytes.
    • getBytesFromFile

      protected byte[] getBytesFromFile()
      Get ClassFile bytes from file.
      Returns:
      ClassFile bytes from file.
    • loadOrAddClassFile

      protected void loadOrAddClassFile(byte[] bytes) throws IOException
      Load or add a ClassFile depending on the Option.compilerMode
      Parameters:
      bytes - the ClassFile bytes
      Throws:
      IOException - if something went wrong
    • listGeneratedClassFile

      private void listGeneratedClassFile(byte[] bytes) throws IOException
      Debug utility: listGeneratedClassFile.
      Parameters:
      bytes - the classFile bytes.
      Throws:
      IOException - if something went wrong.
    • prep

      protected DeclarationList prep(DeclarationList declarationList)
      Prepare the declaration list for attribute output.
      Parameters:
      declarationList - the input declarationList.
      Returns:
      a new prepped declarationList.