Class CodeFlowMap

java.lang.Object
org.ek9lang.compiler.common.CodeFlowMap
All Implemented Interfaces:
CodeFlowAnalyzer
Direct Known Subclasses:
UninitialisedVariableAnalyzer, UnSafePropertyAccessAnalyzer

class CodeFlowMap extends Object implements CodeFlowAnalyzer
Designed to be used in a transient manner when interacting with variables. This is typically through the flow of variable use within a bounded scope. For example within a function or a method. It is transient in the sense that it does not live beyond the parsing of a specific source file. So it is not attached to any scopes or symbols. Instead, those scopes and symbols are used as keys to be able to access specific meta-data that is recorded/accessed during flow of the ek9 code.
This approach has been taken to ensure that memory is not excessively used and the scope/symbol concepts are not mixed with what is in effect a sort of interpreter assessment. In addition, the nature of these checks means that it is sort of necessary to almost interpret and hold state for variables the flow is followed through the code block.
While the initial reason for this was assessment of variables being initialised or not within branching structures. It will probably also be useful for the checking of Optional (is-set) and Result ('ok'/'error'). It may even be extendable to assess if conditionals are always true/false and for assessing cyclo metric complexity.