org.eclipse.xtext.common.types.JvmIdentifiableElement Java Examples

The following examples show how to use org.eclipse.xtext.common.types.JvmIdentifiableElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultImportsConfiguration.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public JvmDeclaredType getContextJvmDeclaredType(EObject model) {
	if(model != null) {
		JvmIdentifiableElement logicalContainer = logicalContainerProvider.getNearestLogicalContainer(model);
		if(logicalContainer != null) 
			return EcoreUtil2.getContainerOfType(logicalContainer, JvmDeclaredType.class);
		EObject currentElement = model;
		do {
			for(EObject jvmElement: associations.getJvmElements(currentElement)) {
				if(jvmElement instanceof JvmDeclaredType) 
					return (JvmDeclaredType) jvmElement;
			}
			currentElement = currentElement.eContainer();
		} while (currentElement != null);
	}
	return null;
}
 
Example #2
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testSugarOverTypeLiteral_03() throws Exception {
	XtendFile file = file(
			"import org.eclipse.emf.ecore.EPackage\n" +
			"class C {\n" +
			"	def m(Object it) {\n" +
			"		EPackage" +
			"	}" +
			"	def void getEPackage(Object o) {}\n" +
			"}\n"); 
	XtendClass c = (XtendClass) file.getXtendTypes().get(0);
	XtendFunction m = (XtendFunction) c.getMembers().get(0);
	XBlockExpression body = (XBlockExpression) m.getExpression();
	XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
	JvmIdentifiableElement method = featureCall.getFeature();
	assertEquals("C.getEPackage(java.lang.Object)", method.getIdentifier());
}
 
Example #3
Source File: XbaseValidator.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Check
public void checkDelegateConstructorIsFirst(XFeatureCall featureCall) {
	JvmIdentifiableElement feature = featureCall.getFeature();
	if (feature != null && !feature.eIsProxy() && feature instanceof JvmConstructor) {
		JvmIdentifiableElement container = logicalContainerProvider.getNearestLogicalContainer(featureCall);
		if (container != null) {
			if (container instanceof JvmConstructor) {
				XExpression body = logicalContainerProvider.getAssociatedExpression(container);
				if (body == featureCall)
					return;
				if (body instanceof XBlockExpression) {
					List<XExpression> expressions = ((XBlockExpression) body).getExpressions();
					if (expressions.isEmpty() || expressions.get(0) != featureCall) {
						error("Constructor call must be the first expression in a constructor", null, INVALID_CONSTRUCTOR_INVOCATION);
					}
				}
			} else {
				error("Constructor call must be the first expression in a constructor", null, INVALID_CONSTRUCTOR_INVOCATION);
			}
		}
	}
}
 
Example #4
Source File: OrderSensitivityTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected void doTestClosureMethodAndExpect(final String declarator, final String expression, final String expectation) {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("new ");
    _builder.append(declarator);
    _builder.append("().run [| ");
    _builder.append(expression);
    _builder.append(" ]");
    XExpression _expression = this.expression(_builder);
    final XMemberFeatureCall featureCall = ((XMemberFeatureCall) _expression);
    final JvmIdentifiableElement feature = featureCall.getFeature();
    Assert.assertNotNull("feature is not null", feature);
    Assert.assertFalse("feature is resolved", feature.eIsProxy());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append(declarator);
    _builder_1.append(".run(");
    _builder_1.append(declarator);
    _builder_1.append("$");
    _builder_1.append(expectation);
    _builder_1.append(")");
    Assert.assertEquals(_builder_1.toString(), feature.getIdentifier());
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #5
Source File: XbaseDeclarativeHoverSignatureProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected String internalGetSignature(EObject object, boolean typeAtEnd) {
	PolymorphicDispatcher<String> polymorphicDispatcher = new PolymorphicDispatcher<String>("_signature", 2, 2,
			Collections.singletonList(this), new ErrorHandler<String>() {
				@Override
				public String handle(Object[] params, Throwable throwable) {
					return null;
				}
			});
	String result = polymorphicDispatcher.invoke(object, typeAtEnd);
	if (result != null)
		return result;
	if (object instanceof JvmIdentifiableElement) {
		return getLabel(object);
	}
	return getLabelForNonXbaseElement(object);
}
 
Example #6
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testBug403580_04() throws Exception {
	XtendFile file = file(
			"abstract class C {\n" +
			"	def void m() {\n" +
			"		overloaded [ String s | s.length ]\n" +
			"	}\n" +
			"	def void overloaded((String)=>String s)" +
			"	def <T> void overloaded(Comparable<T> c)" + 
			"}\n"); 
	XtendClass c = (XtendClass) file.getXtendTypes().get(0);
	XtendFunction m = (XtendFunction) c.getMembers().get(0);
	XBlockExpression body = (XBlockExpression) m.getExpression();
	XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
	JvmIdentifiableElement method = featureCall.getFeature();
	assertEquals("C.overloaded(java.lang.Comparable)", method.getIdentifier());
}
 
Example #7
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testOverloadedMethods_16() throws Exception {
	XtendFile file = file(
			"import java.util.Collection\n" +
			"class X {\n" +
			"  def <T> foo(Collection<? super T> collection, Iterable<T> elements) {\n" +
			"    collection.addAll(elements.head)\n" +
			"  }\n" +
			"}");
	XtendClass clazz = (XtendClass) file.getXtendTypes().get(0);
	XtendFunction func  = (XtendFunction) clazz.getMembers().get(0);
	XMemberFeatureCall featureCall = (XMemberFeatureCall) ((XBlockExpression) func.getExpression()).getExpressions().get(0);
	JvmIdentifiableElement addAll = featureCall.getFeature();
	assertNotNull(addAll);
	assertFalse(addAll.eIsProxy());
	assertEquals("org.eclipse.xtext.xbase.lib.CollectionExtensions.addAll(java.util.Collection,T[])", addAll.getIdentifier());
}
 
Example #8
Source File: XExpressionHelper.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
public boolean isOperatorFromExtension(XAbstractFeatureCall featureCall, String concreteSyntax, QualifiedName operatorSymbol, Class<?> definingExtensionClass) {
	if(!equal(concreteSyntax, operatorSymbol.getLastSegment()))
		return false;
	List<QualifiedName> methodNames = getMethodNames(featureCall, operatorSymbol);
	JvmDeclaredType definingJvmType = (JvmDeclaredType) typeReferences.findDeclaredType(definingExtensionClass, featureCall);
	if (definingJvmType == null)
		return false;
	JvmIdentifiableElement feature = featureCall.getFeature();
	if (definingJvmType != feature.eContainer()) {
		return false;
	}
	for (QualifiedName methodName : methodNames) {
		if (methodName.getLastSegment().equals(feature.getSimpleName())) {
			return true;
		}
	}
	return false;
}
 
Example #9
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testSugarOverTypeLiteral_04() throws Exception {
	XtendFile file = file(
			"import org.eclipse.emf.ecore.EPackage\n" +
			"class C {\n" +
			"	def m(Object it) {\n" +
			"		EPackage" +
			"	}" +
			"	def void getEPackage(String s) {}\n" +
			"}\n"); 
	XtendClass c = (XtendClass) file.getXtendTypes().get(0);
	XtendFunction m = (XtendFunction) c.getMembers().get(0);
	XBlockExpression body = (XBlockExpression) m.getExpression();
	XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
	JvmIdentifiableElement method = featureCall.getFeature();
	assertEquals("org.eclipse.emf.ecore.EPackage", method.getIdentifier());
}
 
Example #10
Source File: JvmModelGenerator.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @since 2.16
 */
protected void appendCompilationTemplate(final ITreeAppendable appendable, final JvmIdentifiableElement it) {
  boolean _matched = false;
  if (appendable instanceof TreeAppendable) {
    _matched=true;
    SharedAppendableState _state = ((TreeAppendable)appendable).getState();
    StandardTypeReferenceOwner _standardTypeReferenceOwner = new StandardTypeReferenceOwner(this.commonServices, it);
    final ImportingStringConcatenation target = this.createImportingStringConcatenation(_state, _standardTypeReferenceOwner);
    target.append(this._jvmTypeExtensions.getCompilationTemplate(it));
    ((TreeAppendable)appendable).append(target);
  }
  if (!_matched) {
    String _name = appendable.getClass().getName();
    String _plus = ("unexpected appendable: " + _name);
    throw new IllegalStateException(_plus);
  }
}
 
Example #11
Source File: DefaultFeatureCallValidator.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isDisallowedCall(XAbstractFeatureCall call) {
	if (call != null && call.getFeature() != null) {
		final JvmIdentifiableElement feature = call.getFeature();
		final String id = feature.getQualifiedName();
		// Exit is forbidden on a agent-based system
		if ("java.lang.System.exit".equals(id)) { //$NON-NLS-1$
			return !isInsideOOTypeDeclaration(call);
		}
		// Avoid any call to the hidden functions (function name contains "$" character).
		final String simpleName = feature.getSimpleName();
		if (Utils.isHiddenMember(simpleName)
			&& !Utils.isNameForHiddenCapacityImplementationCallingMethod(simpleName)
			&& (!Utils.isImplicitLambdaParameterName(simpleName) || !isInsideClosure(call))) {
			return true;
		}
		// Avoid any reference to private API.
		if (isPrivateAPI(feature) && !isPrivateAPI(call)) {
			return true;
		}
	}
	return false;
}
 
Example #12
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testBug403580_06() throws Exception {
	XtendFile file = file(
			"abstract class C {\n" +
			"	def void m() {\n" +
			"		overloaded [ String s | s.length ]\n" +
			"	}\n" +
			"	def void overloaded((String)=>String s)" +
			"	def void overloaded(Object o)" +
			"}\n"); 
	XtendClass c = (XtendClass) file.getXtendTypes().get(0);
	XtendFunction m = (XtendFunction) c.getMembers().get(0);
	XBlockExpression body = (XBlockExpression) m.getExpression();
	XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
	JvmIdentifiableElement method = featureCall.getFeature();
	assertEquals("C.overloaded(java.lang.Object)", method.getIdentifier());
}
 
Example #13
Source File: AbstractOverloadedStaticMethodTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected void linksTo(final String invocation, final String method) {
  try {
    final XtendFile file = this.file(this.inMethodBody(invocation), false);
    XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
    final XtendClass c = ((XtendClass) _head);
    XtendMember _head_1 = IterableExtensions.<XtendMember>head(c.getMembers());
    final XtendFunction m = ((XtendFunction) _head_1);
    XExpression _expression = m.getExpression();
    final XBlockExpression body = ((XBlockExpression) _expression);
    XExpression _last = IterableExtensions.<XExpression>last(body.getExpressions());
    final XAbstractFeatureCall featureCall = ((XAbstractFeatureCall) _last);
    JvmIdentifiableElement _feature = featureCall.getFeature();
    final JvmOperation operation = ((JvmOperation) _feature);
    final StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(this.services, file);
    final ParameterizedTypeReference declaration = owner.newParameterizedTypeReference(operation.getDeclaringType());
    final BottomResolvedOperation resolved = new BottomResolvedOperation(operation, declaration, this.overrideTester);
    Assert.assertEquals(method, resolved.getSimpleSignature());
    Assert.assertTrue(IterableExtensions.join(file.eResource().getErrors(), "\n"), file.eResource().getErrors().isEmpty());
    Assert.assertNull(featureCall.getImplicitReceiver());
    Assert.assertNull(featureCall.getImplicitFirstArgument());
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #14
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testBug403580_01() throws Exception {
	XtendFile file = file(
			"abstract class C {\n" +
			"	def void m() {\n" +
			"		overloaded [ String s | s ]\n" +
			"	}\n" +
			"	def void overloaded(Object o)" +
			"	def <T> void overloaded(Comparable<T> c)" + 
			"}\n"); 
	XtendClass c = (XtendClass) file.getXtendTypes().get(0);
	XtendFunction m = (XtendFunction) c.getMembers().get(0);
	XBlockExpression body = (XBlockExpression) m.getExpression();
	XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
	JvmIdentifiableElement method = featureCall.getFeature();
	assertEquals("C.overloaded(java.lang.Object)", method.getIdentifier());
}
 
Example #15
Source File: LinkingTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testOverloadedMethods_20() throws Exception {
	XtendFile file = file(
			"import java.util.Collection\n" +
			"class X {\n" +
			"  def <T> foo(Collection<T> collection, T head) {\n" +
			"    collection.addAll(head)\n" +
			"  }\n" +
			"}");
	XtendClass clazz = (XtendClass) file.getXtendTypes().get(0);
	XtendFunction func  = (XtendFunction) clazz.getMembers().get(0);
	XMemberFeatureCall featureCall = (XMemberFeatureCall) ((XBlockExpression) func.getExpression()).getExpressions().get(0);
	JvmIdentifiableElement addAll = featureCall.getFeature();
	assertNotNull(addAll);
	assertFalse(addAll.eIsProxy());
	assertEquals("org.eclipse.xtext.xbase.lib.CollectionExtensions.addAll(java.util.Collection,T[])", addAll.getIdentifier());
}
 
Example #16
Source File: SARLUIStrings.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Replies the styled parameters.
 *
 * @param element the element from which the parameters are extracted.
 * @return the styled parameters
 * @since 0.6
 */
public StyledString styledParameters(JvmIdentifiableElement element) {
	final StyledString str = new StyledString();
	if (element instanceof JvmExecutable) {
		final JvmExecutable executable = (JvmExecutable) element;
		str.append(this.keywords.getLeftParenthesisKeyword());
		str.append(parametersToStyledString(
				executable.getParameters(),
				executable.isVarArgs(),
				false));
		str.append(this.keywords.getRightParenthesisKeyword());
	}
	return str;
}
 
Example #17
Source File: SARLHoverSignatureProvider.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected String _signature(XAbstractFeatureCall featureCall, boolean typeAtEnd) {
	final JvmIdentifiableElement feature = featureCall.getFeature();
	if (feature != null) {
		return internalGetSignature(feature, typeAtEnd);
	}
	return ""; //$NON-NLS-1$
}
 
Example #18
Source File: ValidatingReassigningResolvedTypes.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public LightweightTypeReference getActualType(JvmIdentifiableElement identifiable) {
	LightweightTypeReference result = super.getActualType(identifiable);
	if (!result.isOwnedBy(getReferenceOwner())) {
		throw new IllegalArgumentException("result is not owned by this resolved types");
	}
	return result;
}
 
Example #19
Source File: ValidatingRootResolvedTypes.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void reassignType(JvmIdentifiableElement identifiable, LightweightTypeReference reference) {
	if (reference != null && !reference.isOwnedBy(getReferenceOwner())) {
		throw new IllegalArgumentException("reference is not owned by this resolved types");
	}
	super.reassignType(identifiable, reference);
}
 
Example #20
Source File: ResolvedTypes.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public void reassignType(JvmIdentifiableElement identifiable, /* @Nullable */ LightweightTypeReference reference) {
	if (reference != null) {
		LightweightTypeReference actualType = getActualType(identifiable);
		if (actualType != null) {
			if (actualType.getKind() == LightweightTypeReference.KIND_UNBOUND_TYPE_REFERENCE && !((UnboundTypeReference) actualType).internalIsResolved()) {
				UnboundTypeReference casted = (UnboundTypeReference) actualType;
				List<LightweightBoundTypeArgument> hints = getHints(casted.getHandle());
				boolean canAddHint = true;
				for(int i = 0; i < hints.size() && canAddHint; i++) {
					LightweightBoundTypeArgument hint = hints.get(i);
					if (hint.getTypeReference() == null || (hint.getSource() != BoundTypeArgumentSource.EXPECTATION && hint.getSource() != BoundTypeArgumentSource.INFERRED_CONSTRAINT)) {
						canAddHint = false;
					}
				}
				if (canAddHint) {
					casted.acceptHint(reference, BoundTypeArgumentSource.EXPECTATION, identifiable, VarianceInfo.OUT, VarianceInfo.OUT);
				}
				ensureReassignedTypesMapExists().put(identifiable, reference);
			} else if (!reference.isAssignableFrom(actualType)) {
				if (actualType.isAssignableFrom(reference)) {
					ensureReassignedTypesMapExists().put(identifiable, reference);
				} else {
					CompoundTypeReference multiType = toMultiType(actualType, reference);
					ensureReassignedTypesMapExists().put(identifiable, multiType);					
				}
			}
		} else {
			ensureReassignedTypesMapExists().put(identifiable, reference);
		}
	} else {
		if (reassignedTypes != null)
			reassignedTypes.remove(identifiable);
	}
}
 
Example #21
Source File: SARLEarlyExitComputer.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected Collection<ExitPoint> _exitPoints(XAbstractFeatureCall expression) {
	final Collection<ExitPoint> exitPoints = super._exitPoints(expression);
	if (isNotEmpty(exitPoints)) {
		return exitPoints;
	}
	final JvmIdentifiableElement element = expression.getFeature();
	if (isEarlyExitAnnotatedElement(element)) {
		return Collections.<ExitPoint>singletonList(new SarlExitPoint(expression, false));
	}
	return Collections.emptyList();
}
 
Example #22
Source File: DefaultActionPrototypeProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void resetPrototypes_createdProtype_varArg() {
	JvmIdentifiableElement container = createJvmIdentifiableElementStub();
	QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct");
	ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(true, this.sarlParameters);
	assertNotNull(types);
	InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters);
	assertNotNull(prototype);
	//
	assertTrue(this.provider.getPrototypes(this.context, qn).iterator().hasNext());
	this.context.release();
	assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext());
}
 
Example #23
Source File: AbstractExpressionGenerator.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Compute the simple name for the called feature.
 *
 * @param featureCall the feature call.
 * @param logicalContainerProvider the provider of logicial container.
 * @param featureNameProvider the provider of feature name.
 * @param nullKeyword the null-equivalent keyword.
 * @param thisKeyword the this-equivalent keyword.
 * @param superKeyword the super-equivalent keyword.
 * @param referenceNameLambda replies the reference name or {@code null} if none.
 * @return the simple name.
 */
public static String getCallSimpleName(XAbstractFeatureCall featureCall,
		ILogicalContainerProvider logicalContainerProvider,
		IdentifiableSimpleNameProvider featureNameProvider,
		Function0<? extends String> nullKeyword,
		Function0<? extends String> thisKeyword,
		Function0<? extends String> superKeyword,
		Function1<? super JvmIdentifiableElement, ? extends String> referenceNameLambda) {
	String name = null;
	final JvmIdentifiableElement calledFeature = featureCall.getFeature();
	if (calledFeature instanceof JvmConstructor) {
		final JvmDeclaredType constructorContainer = ((JvmConstructor) calledFeature).getDeclaringType();
		final JvmIdentifiableElement logicalContainer = logicalContainerProvider.getNearestLogicalContainer(featureCall);
		final JvmDeclaredType contextType = ((JvmMember) logicalContainer).getDeclaringType();
		if (contextType == constructorContainer) {
			name = thisKeyword.apply();
		} else {
			name = superKeyword.apply();
		}
	} else if (calledFeature != null) {
		final String referenceName = referenceNameLambda.apply(calledFeature);
		if (referenceName != null) {
			name = referenceName;
		} else if (calledFeature instanceof JvmOperation) {
			name = featureNameProvider.getSimpleName(calledFeature);
		} else {
			name = featureCall.getConcreteSyntaxFeatureName();
		}
	}
	if (name == null) {
		return nullKeyword.apply();
	}
	return name;
}
 
Example #24
Source File: ThrownExceptionSwitch.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Boolean caseXAbstractFeatureCall(XAbstractFeatureCall object) {
	JvmIdentifiableElement feature = object.getFeature();
	if (feature instanceof JvmExecutable) {
		accept((JvmExecutable)feature);
	}
	return Boolean.TRUE;
}
 
Example #25
Source File: ReceiverFeatureScope.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public ReceiverFeatureScope(IScope parent, IFeatureScopeSession session, XExpression receiver, LightweightTypeReference receiverType, boolean implicit,
		XAbstractFeatureCall featureCall, TypeBucket bucket, JvmIdentifiableElement receiverFeature, OperatorMapping operatorMapping, boolean validStaticState) {
	super(parent, session, featureCall, operatorMapping);
	this.receiver = receiver;
	this.receiverType = receiverType;
	this.implicit = implicit;
	this.bucket = bucket;
	this.receiverFeature = receiverFeature;
	this.validStaticState = validStaticState;
}
 
Example #26
Source File: LogicalContainerAwareReentrantTypeResolver.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected boolean isHandled(JvmIdentifiableElement identifiableElement) {
	// if the identifiable is a formal parameter, use the nearest logical container since
	// it may be the parameter of a lambda or for loop
	JvmIdentifiableElement container = logicalContainerProvider.getNearestLogicalContainer(identifiableElement);
	if (container != null) {
		return super.isHandled(container);
	}
	return super.isHandled(identifiableElement);
}
 
Example #27
Source File: ConstantConditionsInterpreter.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
public JvmIdentifiableElement getFeature(final XAbstractFeatureCall call, final EvaluationContext context) {
  Object _eGet = call.eGet(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, false);
  JvmIdentifiableElement feature = ((JvmIdentifiableElement) _eGet);
  if (((feature == null) || feature.eIsProxy())) {
    feature = context.getResolvedTypes().getLinkedFeature(call);
  }
  return feature;
}
 
Example #28
Source File: SARLEarlyExitValidator.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected void collectExits(EObject expr, List<XExpression> found) {
	super.collectExits(expr, found);
	if (expr instanceof XAbstractFeatureCall) {
		final JvmIdentifiableElement element = ((XAbstractFeatureCall) expr).getFeature();
		if (this.earlyExitComputer.isEarlyExitAnnotatedElement(element)) {
			found.add((XExpression) expr);
		}
	}
}
 
Example #29
Source File: LogicalContainerAwareReentrantTypeResolver.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected AbstractReentrantTypeReferenceProvider createTypeProvider(
		Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByContext, ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmMember member, 
		/* @Nullable */ XExpression expression, boolean returnType) {
	if (expression != null) {
		markToBeInferred(resolvedTypes, expression);
		return new DemandTypeReferenceProvider(member, expression, resolvedTypesByContext, resolvedTypes, featureScopeSession, returnType);
	}
	return new AnyTypeReferenceProvider(member, resolvedTypes, this); 
}
 
Example #30
Source File: SARLHoverSignatureProvider.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected String _signature(XConstructorCall featureCall, boolean typeAtEnd) {
	final JvmIdentifiableElement feature = featureCall.getConstructor();
	if (feature != null) {
		return internalGetSignature(feature, typeAtEnd);
	}
	return ""; //$NON-NLS-1$
}