Java Code Examples for org.eclipse.xtext.xbase.typesystem.IResolvedTypes#getLinkedFeature()
The following examples show how to use
org.eclipse.xtext.xbase.typesystem.IResolvedTypes#getLinkedFeature() .
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: CompoundReentrantTypeResolver.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public JvmIdentifiableElement getLinkedFeature(/* @Nullable */ XAbstractFeatureCall featureCall) { if (featureCall == null) return null; IResolvedTypes delegate = getDelegate(featureCall); return delegate.getLinkedFeature(featureCall); }
Example 2
Source File: CompoundReentrantTypeResolver.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public JvmIdentifiableElement getLinkedFeature(/* @Nullable */ XConstructorCall constructorCall) { if (constructorCall == null) return null; IResolvedTypes delegate = getDelegate(constructorCall); return delegate.getLinkedFeature(constructorCall); }
Example 3
Source File: FeatureScopes.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
/** * This method serves as an entry point for the content assist scoping for features. * @param featureCall the context provides access to the resource set. If it is an assignment, it * will be used to restrict scoping. * @param receiver the receiver of the feature call. * @param resolvedTypes TODO * @param session TODO */ public IScope createFeatureCallScopeForReceiver(final XExpression featureCall, final XExpression receiver, IFeatureScopeSession session, IResolvedTypes resolvedTypes) { if (receiver == null || receiver.eIsProxy()) return IScope.NULLSCOPE; LightweightTypeReference receiverType = resolvedTypes.getActualType(receiver); if (receiverType != null && !isUnknownReceiverType(receiverType)) { JvmIdentifiableElement linkedReceiver = resolvedTypes.getLinkedFeature(asAbstractFeatureCall(receiver)); boolean typeLiteral = false; IScope root = createTypeLiteralScope(featureCall, receiver, session, resolvedTypes, receiverType, linkedReceiver); if (root != null) { if (featureCall instanceof XMemberFeatureCall && ((XMemberFeatureCall) featureCall).isExplicitStatic()) { return root; } typeLiteral = true; } else { root = IScope.NULLSCOPE; } // check if 'super' was used as receiver which renders extension features and static features invalid if (typeLiteral || isValidFeatureCallArgument(receiver, linkedReceiver, session)) { // static members that are invoked on a receiver, e.g. myString.CASE_INSENSITIVE_ORDER IScope staticScope = createStaticScope(asAbstractFeatureCall(featureCall), receiver, receiverType, root, session, resolvedTypes); // static extensions, if any, e.g. iterable.map [], or things that have been imported by means of import static extension MyType IScope staticExtensionScope = createStaticExtensionsScope(receiver, receiverType, featureCall, staticScope, session, resolvedTypes); // instance extensions, e.g. extension ReflectionUtils with myObject.get('privateField') IScope extensionScope = createDynamicExtensionsScope(receiver, receiverType, featureCall, staticExtensionScope, session, resolvedTypes); // instance members, e.g. this.toString return createFeatureScopeForTypeRef(receiver, receiverType, false, featureCall, session, linkedReceiver, extensionScope, true); } else { // put only instance members into the scope return createFeatureScopeForTypeRef(receiver, receiverType, false, featureCall, session, linkedReceiver, IScope.NULLSCOPE, true); } } else if (typeLiteralHelper.isPotentialTypeLiteral(featureCall, resolvedTypes)) { IScope errorScope = createFollowUpErrorScope(receiverType); List<String> prefix = typeLiteralHelper.getTypeNameSegmentsFromConcreteSyntax((XMemberFeatureCall) featureCall); if (prefix == null) { return errorScope; } return createTypeLiteralScope(featureCall, QualifiedName.create(prefix), errorScope, session, resolvedTypes); } else { return createFollowUpErrorScope(receiverType); } }