Class LocalObject
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-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 Summary
FieldsModifier and TypeFieldDescription(package private) ClassDeclaration
The class declaration.private 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
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDefault constructor used by Attribute File I/Oprivate
LocalObject
(String ident) Create a new LocalObject -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildEvaluation
(Expression rightPart, CodeBuilder codeBuilder) ClassFile coding utility: Build Evaluation Code.void
Perform semantic checking.(package private) static Expression
Expect Identifier following THIS.private void
findThis()
Follow Static Chain Looking for a Class named 'classIdentifier'boolean
Returns true if this expression may be used as a statement.static LocalObject
Read and return an object.Generate Java code for this Syntax Class.toString()
void
Write a SyntaxClass object to a AttributeOutputStream.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, buildByteCode, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED, setLineNumber
-
Field Details
-
classIdentifier
The class identifier. -
classDeclaration
ClassDeclaration classDeclarationThe class declaration. Set by doChecking. -
thisScope
THIS scope. Set by doChecking. -
ctxDiff
private int ctxDiffContext difference. Set by doChecking.
-
-
Constructor Details
-
LocalObject
-
LocalObject
public LocalObject()Default constructor used by Attribute File I/O
-
-
Method Details
-
expectThisIdentifier
Expect Identifier following THIS.- 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
-
buildEvaluation
Description copied from class:Expression
ClassFile coding utility: Build Evaluation Code.- Specified by:
buildEvaluation
in classExpression
- Parameters:
rightPart
- expressioncodeBuilder
- the codeBuilder used.
-
toString
- Overrides:
toString
in classExpression
-
writeObject
Description copied from class:SyntaxClass
Write a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObject
in classSyntaxClass
- Parameters:
oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readObject
Read and return an object.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the object read from the stream.
- Throws:
IOException
- if something went wrong.
-