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).
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidemit(ErrorListener errorListener, IToken location, String message, ErrorListener.SemanticClassification classification) Report the diagnostic through the listener of the token's source.static ErrorListenerlistenerOrThrow(ErrorListener errorListener, IToken location, String what) The listener, or a hard internal error saying which diagnostic would have been dropped and where.
-
Method Details
-
emit
public static 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
public static ErrorListener listenerOrThrow(ErrorListener errorListener, IToken location, String what) 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
-