java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.expression.Expression
simula.compiler.syntaxClass.expression.LocalObject
LocalObject i.e. This class expression.
Simula Standard: 3.8 Object expressions local-object = THIS class-identifierA 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 Summary
Modifier and TypeFieldDescriptionprivate ClassDeclaration
The class declaration.private final String
The class identifier.private int
Context difference.private DeclarationScope
THIS scope.Fields inherited from class simula.compiler.syntaxClass.expression.Expression
backLink, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform semantic checking.(package private) static Expression
Expect This Identifier.private void
findThis()
Follow Static Chain Looking for a Class named 'classIdentifier'boolean
Returns true if this expression may be used as a statement.Generate Java code for this Syntax Class.toString()
Methods inherited from class simula.compiler.syntaxClass.expression.Expression
acceptExpression, checkCompatibility, evaluate, expectExpression, get, getInt, getNumber, getQualification, getWriteableVariable, printTree, put
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED
-
Field Details
-
classIdentifier
The class identifier. -
classDeclaration
The class declaration. Set by doChecking. -
thisScope
THIS scope. Set by doChecking. -
ctxDiff
private int ctxDiffContext difference. Set by doChecking.
-
-
Constructor Details
-
LocalObject
Create a new LocalObject- Parameters:
ident
- class-identifier
-
-
Method Details
-
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 classSyntaxClass
-
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 classExpression
- Returns:
- true if this expression may be used as a statement
-
toJavaCode
Description copied from class:SyntaxClass
Generate Java code for this Syntax Class.- Overrides:
toJavaCode
in classSyntaxClass
- Returns:
- Java code
-
toString
- Overrides:
toString
in classExpression
-