Class InstructionBlockVariablesOrError
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
org.ek9lang.compiler.phase3.InstructionBlockVariablesOrError
- All Implemented Interfaces:
Consumer<EK9Parser.InstructionBlockContext>
final class InstructionBlockVariablesOrError
extends TypedSymbolAccess
implements Consumer<EK9Parser.InstructionBlockContext>
Checks that variable only and variable declarations have symbols that have been referenced.
This is a bit like 'golang', it is considered an error if accessed before initialising or if not used.
There are a couple of exceptions around 'injection' as that can only really be detected at runtime (hence avoid).
One verdict is DEFERRED to PRE_IR_CHECKS (E08090, item 5): a variable initialised by a CALL whose later uses are
only in-place mutations (view <- config.get("server"); view :~: overrides). The call may have handed back
a view of something that IS read later, and then mutating it is a use - which only the callee's RETAINS can say,
and for a user method that is derived in phase 5. Anything clearly fresh (a literal, a constructor, a declaration
without an initialiser, a function reference) and anything re-pointed keeps today's verdict here.
-
Field Summary
Fields inherited from class RuleSupport
errorListener, symbolsAndScopes -
Constructor Summary
ConstructorsConstructorDescriptionInstructionBlockVariablesOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Check on references to variables in blocks. -
Method Summary
Methods inherited from class TypedSymbolAccess
getRecordedAndTypedSymbol, isProcessingScopePure, recordATypedSymbol
-
Constructor Details
-
InstructionBlockVariablesOrError
InstructionBlockVariablesOrError(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Check on references to variables in blocks.
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceConsumer<EK9Parser.InstructionBlockContext>
-