Class CrossSourceErrors
java.lang.Object
org.ek9lang.compiler.support.CrossSourceErrors
THE emission of a diagnostic raised by a whole-program analysis, which finds its error listener by LOOKING UP the
source its token belongs to (call-graph detectors, the deadlock check, construction recursion, injection
reachability). The lookup can miss - a source-name form nobody anticipated - and a miss must never swallow the
error: "if it compiles, it is free of this" would silently stop being true. So an unresolved listener is a hard
internal error naming the place and the code (front-end rationalisation D-4: the deadlock check threw, five other
emitters returned quietly - the very drop the deadlock check's own javadoc calls the original defect).
One responsibility - a cross-source diagnostic is never dropped - with two doors: report it, or obtain the listener it must go through. Hold an instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidemit(ErrorListener errorListener, IToken location, String message, ErrorListener.SemanticClassification classification) Report the diagnostic through the listener of the token's source.listenerOrThrow(ErrorListener errorListener, IToken location, String what) The listener, or a hard internal error saying which diagnostic would have been dropped and where.
-
Constructor Details
-
CrossSourceErrors
public CrossSourceErrors()
-
-
Method Details
-
emit
public void emit(ErrorListener errorListener, IToken location, String message, ErrorListener.SemanticClassification classification) Report the diagnostic through the listener of the token's source.- Parameters:
errorListener- the listener the lookup found, or null when it found nonelocation- the token the diagnostic is reported onmessage- the diagnostic's textclassification- what it is- Throws:
CompilerException- when no listener was found
-
listenerOrThrow
The listener, or a hard internal error saying which diagnostic would have been dropped and where.- Parameters:
errorListener- the listener the lookup found, or nulllocation- where the diagnostic was to be reported (may be null)what- what was to be reported - normally its error code
-