use of org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation in project xtext-xtend by eclipse.
the class CompilationUnitImpl method translate.
protected Object translate(final Object object) {
if ((object instanceof XAnnotation[])) {
final AnnotationReference[] result = new AnnotationReference[((Object[]) object).length];
int _length = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, _length, true);
for (final Integer i : _doubleDotLessThan) {
result[(i).intValue()] = this.translateAnnotation(((XAnnotation[]) object)[(i).intValue()]);
}
return result;
}
if ((object instanceof XAnnotation)) {
return this.translateAnnotation(((XAnnotation) object));
}
if ((object instanceof JvmTypeReference[])) {
final TypeReference[] result_1 = new TypeReference[((Object[]) object).length];
int _length_1 = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, _length_1, true);
for (final Integer i_1 : _doubleDotLessThan_1) {
Object _translate = this.translate(((Object[]) object)[(i_1).intValue()]);
result_1[(i_1).intValue()] = ((TypeReference) _translate);
}
return result_1;
}
if ((object instanceof JvmTypeReference)) {
return this.toTypeReference(((JvmTypeReference) object));
}
if ((object instanceof JvmEnumerationLiteral[])) {
final EnumerationValueDeclaration[] result_2 = new EnumerationValueDeclaration[((Object[]) object).length];
int _length_2 = ((Object[]) object).length;
ExclusiveRange _doubleDotLessThan_2 = new ExclusiveRange(0, _length_2, true);
for (final Integer i_2 : _doubleDotLessThan_2) {
Object _translate_1 = this.translate(((Object[]) object)[(i_2).intValue()]);
result_2[(i_2).intValue()] = ((EnumerationValueDeclaration) _translate_1);
}
return result_2;
}
if ((object instanceof JvmEnumerationLiteral)) {
return this.toMemberDeclaration(((JvmMember) object));
}
return object;
}
use of org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation in project xtext-xtend by eclipse.
the class CompilationUnitImpl method handleProcessingError.
public void handleProcessingError(final Iterable<? extends EObject> sourceElements, final Resource resource, final Throwable t) {
if ((t instanceof VirtualMachineError)) {
throw ((VirtualMachineError) t);
}
boolean _equals = Objects.equal(this.lastPhase, ActiveAnnotationContexts.AnnotationCallback.GENERATION);
if (_equals) {
Throwables.propagateIfPossible(t);
String _messageWithoutStackTrace = this.getMessageWithoutStackTrace(t);
throw new RuntimeException(_messageWithoutStackTrace, t);
}
final String msg = this.getMessageWithStackTrace(t);
final EList<Resource.Diagnostic> errors = resource.getErrors();
for (final EObject target : sourceElements) {
boolean _matched = false;
if (target instanceof XtendAnnotationTarget) {
_matched = true;
final EList<XAnnotation> annotations = ((XtendAnnotationTarget) target).getAnnotations();
EObject _xifexpression = null;
boolean _isEmpty = annotations.isEmpty();
if (_isEmpty) {
_xifexpression = target;
} else {
_xifexpression = IterableExtensions.<XAnnotation>head(annotations);
}
EObjectDiagnosticImpl _eObjectDiagnosticImpl = new EObjectDiagnosticImpl(Severity.ERROR, IssueCodes.PROCESSING_ERROR, msg, _xifexpression, null, (-1), null);
errors.add(_eObjectDiagnosticImpl);
}
if (!_matched) {
EObjectDiagnosticImpl _eObjectDiagnosticImpl = new EObjectDiagnosticImpl(Severity.ERROR, IssueCodes.PROCESSING_ERROR, msg, target, null, (-1), null);
errors.add(_eObjectDiagnosticImpl);
}
}
}
use of org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation in project xtext-xtend by eclipse.
the class CompilationUnitImpl method toAnnotationReference.
public AnnotationReference toAnnotationReference(final XAnnotation delegate) {
final Function1<XAnnotation, XtendAnnotationReferenceImpl> _function = (XAnnotation it) -> {
XtendAnnotationReferenceImpl _xtendAnnotationReferenceImpl = new XtendAnnotationReferenceImpl();
final Procedure1<XtendAnnotationReferenceImpl> _function_1 = (XtendAnnotationReferenceImpl it_1) -> {
it_1.setDelegate(delegate);
it_1.setCompilationUnit(this);
};
return ObjectExtensions.<XtendAnnotationReferenceImpl>operator_doubleArrow(_xtendAnnotationReferenceImpl, _function_1);
};
return this.<XAnnotation, XtendAnnotationReferenceImpl>getOrCreate(delegate, _function);
}
use of org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation in project xtext-xtend by eclipse.
the class XtendHighlightingCalculator method highlightAnnotations.
protected void highlightAnnotations(IHighlightedPositionAcceptor acceptor, XtendAnnotationTarget target) {
if (target != null) {
for (XAnnotation annotation : target.getAnnotations()) {
highlightRichStrings(annotation, acceptor);
highlightDeprecatedXtendAnnotationTarget(acceptor, target, annotation);
}
}
}
Aggregations