java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.expression.Expression
simula.compiler.syntaxClass.expression.ObjectRelation
Object relations
Simula Standard: 3.3.4. Object relations object-relation = simple-object-expression IS class-identifier | simple-object-expression IN class-identifierThe operators IS and IN may be used to test the class membership of an object.
The relation "X IS C" has the value true if X refers to an object belonging to the class C, otherwise the value is false.
The relation "X IN C" has the value true if X refers to an object belonging to a class C or a class inner to C, otherwise the value is false.
The qualification of an object expression is defined by the following rules:
- The expression none is qualified by a fictitious class which is inner to all declared classes.
- A variable or function designator is qualified as stated in the declaration (or specification, see below) of the variable or array or procedure in question.
- An object generator, local object or qualified object is qualified by the class of the identifier following the symbol new, this or qua respectively.
- A conditional object expression is qualified by the innermost class which includes the qualifications of both alternatives. If there is no such class, the expression is illegal.
- Any formal parameter of object reference type is qualified according to its specification regardless of the qualification of the corresponding actual parameter.
- The qualification of a function designator whose procedure identifier is that of a virtual quantity depends on the access level (see 5.5.5). The qualification is that of the matching declaration, if any, occurring at the innermost prefix level equal or outer to the access level, or, if no such match exists, it is that of the virtual specification.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Field Summary
Modifier and TypeFieldDescription(package private) ClassDeclaration
The class declaration.private final String
The right hand class identifier.private final Expression
The left hand side.private final KeyWord
The operation: IN, IS or QUAFields inherited from class simula.compiler.syntaxClass.expression.Expression
backLink, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
ConstructorDescriptionObjectRelation
(Expression lhs, KeyWord opr, String classIdentifier) Create a new ObjectRelation -
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform semantic checking.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
-
lhs
The left hand side. -
opr
The operation: IN, IS or QUA -
classIdentifier
The right hand class identifier. -
classDeclaration
ClassDeclaration classDeclarationThe class declaration.
-
-
Constructor Details
-
ObjectRelation
ObjectRelation(Expression lhs, KeyWord opr, String classIdentifier) Create a new ObjectRelation- Parameters:
lhs
- left hand sideopr
- the operation: IN, IS or QUAclassIdentifier
- the right hand class identifier
-
-
Method Details
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
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
-