use of org.eclipse.xtend.core.xtend.CreateExtensionInfo in project xtext-xtend by eclipse.
the class XtendHighlightingCalculator method highlightElement.
protected void highlightElement(XtendFunction function, IHighlightedPositionAcceptor acceptor, CancelIndicator cancelIndicator) {
highlightFeature(acceptor, function, XtendPackage.Literals.XTEND_FUNCTION__NAME, METHOD);
XExpression rootExpression = function.getExpression();
highlightRichStrings(rootExpression, acceptor);
CreateExtensionInfo createExtensionInfo = function.getCreateExtensionInfo();
if (createExtensionInfo != null) {
highlightRichStrings(createExtensionInfo.getCreateExpression(), acceptor);
}
}
use of org.eclipse.xtend.core.xtend.CreateExtensionInfo in project xtext-xtend by eclipse.
the class XtendFunctionImpl method basicSetCreateExtensionInfo.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCreateExtensionInfo(CreateExtensionInfo newCreateExtensionInfo, NotificationChain msgs) {
CreateExtensionInfo oldCreateExtensionInfo = createExtensionInfo;
createExtensionInfo = newCreateExtensionInfo;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtendPackage.XTEND_FUNCTION__CREATE_EXTENSION_INFO, oldCreateExtensionInfo, newCreateExtensionInfo);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.xtend.core.xtend.CreateExtensionInfo in project xtext-xtend by eclipse.
the class XtendReentrantTypeResolver method computeTypes.
protected void computeTypes(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, XtendMember member) {
XExpression expression = null;
if (member instanceof XtendFunction) {
XtendFunction function = (XtendFunction) member;
expression = function.getExpression();
CreateExtensionInfo createInfo = function.getCreateExtensionInfo();
if (createInfo != null) {
computeDanglingExpressionType(resolvedTypes, featureScopeSession, function, createInfo.getCreateExpression());
}
for (XtendParameter parameter : function.getParameters()) {
computeXtendAnnotationTypes(resolvedTypes, featureScopeSession, parameter.getAnnotations());
}
} else if (member instanceof XtendConstructor) {
XtendConstructor constructor = (XtendConstructor) member;
expression = constructor.getExpression();
for (XtendParameter parameter : constructor.getParameters()) {
computeXtendAnnotationTypes(resolvedTypes, featureScopeSession, parameter.getAnnotations());
}
} else if (member instanceof XtendField) {
expression = ((XtendField) member).getInitialValue();
}
if (expression != null) {
computeDanglingExpressionType(resolvedTypes, featureScopeSession, member, expression);
}
computeXtendAnnotationTypes(resolvedTypes, featureScopeSession, member.getAnnotations());
}
use of org.eclipse.xtend.core.xtend.CreateExtensionInfo in project xtext-xtend by eclipse.
the class XtendJvmModelInferrer method transform.
protected void transform(XtendFunction source, JvmGenericType container, boolean allowDispatch) {
JvmOperation operation = typesFactory.createJvmOperation();
operation.setAbstract(source.isAbstract());
operation.setNative(source.isNative());
operation.setSynchronized(source.isSynchonized());
operation.setStrictFloatingPoint(source.isStrictFloatingPoint());
if (!source.isAbstract())
operation.setFinal(source.isFinal());
container.getMembers().add(operation);
associator.associatePrimary(source, operation);
String sourceName = source.getName();
JvmVisibility visibility = source.getVisibility();
if (allowDispatch && source.isDispatch()) {
if (source.getDeclaredVisibility() == null)
visibility = JvmVisibility.PROTECTED;
sourceName = "_" + sourceName;
}
operation.setSimpleName(sourceName);
operation.setVisibility(visibility);
operation.setStatic(source.isStatic());
if (!operation.isAbstract() && !operation.isStatic() && container.isInterface())
operation.setDefault(true);
for (XtendParameter parameter : source.getParameters()) {
translateParameter(operation, parameter);
}
XExpression expression = source.getExpression();
CreateExtensionInfo createExtensionInfo = source.getCreateExtensionInfo();
JvmTypeReference returnType = null;
if (source.getReturnType() != null) {
returnType = jvmTypesBuilder.cloneWithProxies(source.getReturnType());
} else if (createExtensionInfo != null) {
returnType = jvmTypesBuilder.inferredType(createExtensionInfo.getCreateExpression());
} else if (expression != null) {
returnType = jvmTypesBuilder.inferredType(expression);
} else {
returnType = jvmTypesBuilder.inferredType();
}
operation.setReturnType(returnType);
copyAndFixTypeParameters(source.getTypeParameters(), operation);
for (JvmTypeReference exception : source.getExceptions()) {
operation.getExceptions().add(jvmTypesBuilder.cloneWithProxies(exception));
}
translateAnnotationsTo(source.getAnnotations(), operation);
if (source.isOverride() && generatorConfig.getJavaSourceVersion().isAtLeast(JAVA6) && !containsAnnotation(operation, Override.class) && typeReferences.findDeclaredType(Override.class, source) != null) {
operation.getAnnotations().add(_annotationTypesBuilder.annotationRef(Override.class));
}
if (createExtensionInfo != null) {
transformCreateExtension(source, createExtensionInfo, container, operation, returnType);
} else {
setBody(operation, expression);
}
jvmTypesBuilder.copyDocumentationTo(source, operation);
}
use of org.eclipse.xtend.core.xtend.CreateExtensionInfo in project xtext-xtend by eclipse.
the class EclipseXtendOutlineSourceContext method markCreateExtensionJvmFeaturesAsProcessed.
protected void markCreateExtensionJvmFeaturesAsProcessed(final JvmMember member) {
final EObject function = this._iXtendJvmAssociations.getPrimarySourceElement(member);
if ((function instanceof XtendFunction)) {
CreateExtensionInfo _createExtensionInfo = ((XtendFunction) function).getCreateExtensionInfo();
boolean _tripleNotEquals = (_createExtensionInfo != null);
if (_tripleNotEquals) {
final Function1<JvmFeature, Boolean> _function = (JvmFeature it) -> {
return Boolean.valueOf((!Objects.equal(it, member)));
};
final Function1<JvmFeature, Boolean> _function_1 = (JvmFeature it) -> {
return Boolean.valueOf((it.getSimpleName().startsWith(XtendJvmModelInferrer.CREATE_CHACHE_VARIABLE_PREFIX) || it.getSimpleName().startsWith(XtendJvmModelInferrer.CREATE_INITIALIZER_PREFIX)));
};
Iterable<JvmFeature> _filter = IterableExtensions.<JvmFeature>filter(IterableExtensions.<JvmFeature>filter(Iterables.<JvmFeature>filter(this._iXtendJvmAssociations.getJvmElements(function), JvmFeature.class), _function), _function_1);
for (final JvmFeature jvmFeature : _filter) {
super.markAsProcessed(jvmFeature);
}
}
}
}
Aggregations