Class PreIntermediateRepresentationChecks
java.lang.Object
org.ek9lang.compiler.CompilerPhase
org.ek9lang.compiler.phase5.PreIntermediateRepresentationChecks
- All Implemented Interfaces:
BiFunction<Workspace, CompilerFlags, CompilationPhaseResult>
At this point all templates should be present and all symbols resolved.
This check phase is to look more at the flow of the code and see if there are potential
errors that could be avoided at compile time, rather than allowing some form of runtime failure.
This phase operates in four stages:
- Parallel processing: Each source file is processed by PreIRListener (collecting construct-level metrics and module-level dependency data) and CallGraphCollector (building the program call graph for reachability analysis)
- Module quality validation: After all files are processed, module-level quality metrics are validated (coupling E11016, cohesion E11017)
- Call graph analysis: Detect test quality issues:
- E81007: Empty @Test programs (no assertions and no expected output files)
- E81011: Orphan assertions (not reachable from any @Test)
- E81012: Production assertions (reachable from non-test programs)
- Notification: Notify listeners for each source file
-
Field Summary
Fields inherited from class CompilerPhase
compilableProgramAccess, listener, reporter -
Constructor Summary
ConstructorsConstructorDescriptionPreIntermediateRepresentationChecks(SharedThreadContext<CompilableProgram> compilableProgramAccess, Consumer<CompilationEvent> listener, CompilerReporter reporter) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleandoApply(Workspace workspace, CompilerFlags compilerFlags) Do the compilation phase.Get the call graph built during this phase.Methods inherited from class CompilerPhase
apply, getParsedModuleForSourceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Constructor Details
-
Method Details
-
doApply
Description copied from class:CompilerPhaseDo the compilation phase.- Specified by:
doApplyin classCompilerPhase
-
getCallGraph
Get the call graph built during this phase. Available afterdoApply(Workspace, CompilerFlags)completes. Used for test validation (E81007), dead code detection, etc.- Returns:
- The call graph with all registered callables and edges
-