Module Simula

Class LocalObject


public final class LocalObject extends Expression
LocalObject i.e. This class expression.
 
 Simula Standard: 3.8 Object expressions
 
 local-object = THIS class-identifier
 
 
A local object "this C" is valid provided that the expression is used within the class body of C or that of any subclass of C, or a connection block whose block qualification is C or a subclass of C (see 4.8).

The value of a local object in a given context is the object which is, or is connected by, the smallest textually enclosing block instance in which the local object is valid.

If there is no such block the local object is illegal (in the given context). For an instance of a procedure or a class body, "textually enclosing" means containing its declaration.

Link to GitHub: Source File.

Author:
Simula Standard, Øystein Myhre Andersen
  • Field Details

    • classIdentifier

      private final String classIdentifier
      The class identifier.
    • classDeclaration

      private ClassDeclaration classDeclaration
      The class declaration. Set by doChecking.
    • thisScope

      private DeclarationScope thisScope
      THIS scope. Set by doChecking.
    • ctxDiff

      private int ctxDiff
      Context difference. Set by doChecking.
  • Constructor Details

    • LocalObject

      private LocalObject(String ident)
      Create a new LocalObject
      Parameters:
      ident - class-identifier
  • Method Details

    • expectThisIdentifier

      static Expression expectThisIdentifier()
      Expect This Identifier.
      Returns:
      the newly created LocalObject.
    • doChecking

      public void doChecking()
      Description copied from class: SyntaxClass
      Perform semantic checking.

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • findThis

      private void findThis()
      Follow Static Chain Looking for a Class named 'classIdentifier'
    • maybeStatement

      public boolean maybeStatement()
      Description copied from class: Expression
      Returns true if this expression may be used as a statement.
      Specified by:
      maybeStatement in class Expression
      Returns:
      true if this expression may be used as a statement
    • toJavaCode

      public String toJavaCode()
      Description copied from class: SyntaxClass
      Generate Java code for this Syntax Class.
      Overrides:
      toJavaCode in class SyntaxClass
      Returns:
      Java code
    • toString

      public String toString()
      Overrides:
      toString in class Expression