Class MakesIdentifierSubsequentAccessSafe
java.lang.Object
org.ek9lang.compiler.phase5.MakesIdentifierSubsequentAccessSafe
- All Implemented Interfaces:
Predicate<EK9Parser.IdentifierContext>
final class MakesIdentifierSubsequentAccessSafe
extends Object
implements Predicate<EK9Parser.IdentifierContext>
A bit of a catch 22, need to issue errors and the like when traversing an identifier in
some circumstances. But not if the identifierReference is actually being used in a 'is-set' test.
But it maybe that this is an assignment which then makes subsequent access SAFE.
So I don't like doing this sort of thing because it makes the grammar fragile. But here I need to traverse back up
the grammar structure to see if this identifier is being used as part of a '?' expression or a safe assignment.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Optional<EK9Parser.AssignmentStatementContext> THE assignment statement this identifier is the TARGET of - on its left-hand side, reached directly or through an object access (this.count: 1) - or empty.boolean
-
Constructor Details
-
MakesIdentifierSubsequentAccessSafe
MakesIdentifierSubsequentAccessSafe()
-
-
Method Details
-
test
- Specified by:
testin interfacePredicate<EK9Parser.IdentifierContext>
-
assignmentTargetOf
static Optional<EK9Parser.AssignmentStatementContext> assignmentTargetOf(EK9Parser.IdentifierContext ctx) THE assignment statement this identifier is the TARGET of - on its left-hand side, reached directly or through an object access (this.count: 1) - or empty. An identifier on the RIGHT-hand side is a read, not the target:count: foo(count)used to find the statement from the argument too, so the unset 'count' it reads was treated as being assigned and never checked (found fixing front-end audit FE32).
-