use of org.eclipse.xtend.lib.macro.TransformationParticipant in project xtext-xtend by eclipse.
the class AnnotationProcessor method inferencePhase.
public Object inferencePhase(final ActiveAnnotationContext ctx, final CancelIndicator monitor) {
Object _xblockexpression = null;
{
final Stopwatches.StoppedTask task = Stopwatches.forTask("[macros] inferencePhase (AnnotationProcessor.inferencePhase)");
task.start();
Object _xtrycatchfinallyexpression = null;
try {
Object _switchResult = null;
Object _processorInstance = ctx.getProcessorInstance();
final Object processor = _processorInstance;
boolean _matched = false;
if (processor instanceof TransformationParticipant) {
_matched = true;
Object _xblockexpression_1 = null;
{
final TransformationContextImpl modifyCtx = this.modifyContextProvider.get();
modifyCtx.setUnit(ctx.getCompilationUnit());
final Runnable _function = () -> {
final Function1<XtendAnnotationTarget, MutableNamedElement> _function_1 = (XtendAnnotationTarget it) -> {
Declaration _switchResult_1 = null;
boolean _matched_1 = false;
if (it instanceof XtendMember) {
_matched_1 = true;
_switchResult_1 = ctx.getCompilationUnit().toXtendMemberDeclaration(((XtendMember) it));
}
if (!_matched_1) {
if (it instanceof XtendParameter) {
_matched_1 = true;
_switchResult_1 = ctx.getCompilationUnit().toXtendParameterDeclaration(((XtendParameter) it));
}
}
final Declaration xtendMember = _switchResult_1;
Element _primaryGeneratedJavaElement = modifyCtx.getPrimaryGeneratedJavaElement(xtendMember);
return ((MutableNamedElement) _primaryGeneratedJavaElement);
};
final List<MutableNamedElement> map = ListExtensions.<XtendAnnotationTarget, MutableNamedElement>map(ctx.getAnnotatedSourceElements(), _function_1);
((TransformationParticipant<MutableNamedElement>) processor).doTransform(map, modifyCtx);
};
_xblockexpression_1 = this.runWithCancelIndiciator(ctx, monitor, _function);
}
_switchResult = _xblockexpression_1;
}
_xtrycatchfinallyexpression = _switchResult;
} finally {
task.stop();
}
_xblockexpression = _xtrycatchfinallyexpression;
}
return _xblockexpression;
}
Aggregations