use of mb.nabl2.constraints.messages.MessageInfo in project spoofax by metaborg.
the class AbstractConstraintAnalyzer method message.
private IMessage message(ITerm originatingTerm, IMessageInfo messageInfo, MessageSeverity severity, IUnifier unifier, C context, FileObject defaultLocation) {
Optional<TermOrigin> maybeOrigin = TermOrigin.get(originatingTerm);
if (maybeOrigin.isPresent()) {
TermOrigin origin = maybeOrigin.get();
ISourceRegion region = JSGLRSourceRegionFactory.fromTokens(origin.getLeftToken(), origin.getRightToken());
FileObject resource = resourceService.resolve(context.location(), origin.getResource());
String message = messageInfo.getContent().apply(unifier::findRecursive).toString(prettyprint(context, resource(resource, context)));
return MessageFactory.newAnalysisMessage(resource, region, message, severity, null);
} else {
String message = messageInfo.getContent().apply(unifier::findRecursive).toString(prettyprint(context, null));
return MessageFactory.newAnalysisMessageAtTop(defaultLocation, message, severity, null);
}
}
Aggregations