protected boolean isStaticAccessSyntax() { XAbstractFeatureCall featureCall = getFeatureCall(); if (featureCall instanceof XMemberFeatureCall) { return ((XMemberFeatureCall) featureCall).isExplicitStatic(); } return false; }
private boolean isExplicitStaticFeatureCall() { XAbstractFeatureCall featureCall = getFeatureCall(); if (featureCall instanceof XMemberFeatureCall) { return ((XMemberFeatureCall) featureCall).isExplicitStatic(); } return false; }
/** * Returns <code>true</code> if the given feature call can be a type literal (structurally). * Otherwise <code>false</code>. */ public boolean isPotentialTypeLiteral(XExpression featureCall, /* @Nullable */ IResolvedTypes resolvedTypes) { if (featureCall instanceof XMemberFeatureCall) { return isPotentialTypeLiteralImpl(featureCall, resolvedTypes, ((XMemberFeatureCall) featureCall).isExplicitStatic()); } return isPotentialTypeLiteralImpl(featureCall, resolvedTypes, false); }
/** * Returns the segments that are preceding the feature call, e.g. it returns * <code>'java', 'lang'</code> for a feature call <code>java.lang.String</code>. * <code>java::lang::String</code>. * Returns <code>null</code> if no such segments exist, e.g. because the member call target * does not indicate a type reference syntactically, e.g. <code>(java.lang).String</code>. */ /* @Nullable */ public List<String> getTypeNameSegmentsFromConcreteSyntax(XMemberFeatureCall featureCall) { List<INode> nodes = NodeModelUtils.findNodesForFeature(featureCall, XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET); List<String> prefix = getTypeNameSegmentsFromConcreteSyntax(nodes, featureCall.isExplicitStatic()); return prefix; }
protected boolean isStaticMemberCallTarget(final EObject contextObject) { boolean candidate = ((contextObject instanceof XFeatureCall) && (contextObject.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET)); if (candidate) { EObject _eContainer = contextObject.eContainer(); XMemberFeatureCall memberFeatureCall = ((XMemberFeatureCall) _eContainer); boolean _isExplicitStatic = memberFeatureCall.isExplicitStatic(); if (_isExplicitStatic) { return true; } } return false; }
private XMemberFeatureCall getLongestTypeLiteralCandidate(XMemberFeatureCall current, boolean mustBeStatic) { if (current.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall container = (XMemberFeatureCall) current.eContainer(); if (canBeTypeLiteral(container)) { if (!mustBeStatic && !container.isExplicitStatic()) { return null; } if (mustBeStatic != container.isExplicitStatic()) { return current; } if (mustBeStatic && container.eContainingFeature() != XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { return current; } return getLongestTypeLiteralCandidate(container, mustBeStatic); } } if (mustBeStatic) { return null; } if (!mustBeStatic && !current.isExplicitStatic()) { return null; } return current; }
protected XAbstractFeatureCall doGetRootTypeLiteral(XMemberFeatureCall featureCall) { boolean staticNotation = featureCall.isExplicitStatic(); XMemberFeatureCall current = featureCall; while(current.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall container = (XMemberFeatureCall) current.eContainer(); if (container.isExplicitStatic()) { if (staticNotation == false) { return current; } current = container; } else if (staticNotation) { return (XAbstractFeatureCall) current.getMemberCallTarget(); } else { current = container; } } if (current != featureCall && staticNotation) { return (XAbstractFeatureCall) current.getMemberCallTarget(); } return null; }
public boolean isDefiniteTypeLiteral(XAbstractFeatureCall featureCall) { if (featureCall.isExplicitOperationCallOrBuilderSyntax()) return false; if (!featureCall.getTypeArguments().isEmpty()) return false; if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall container = (XMemberFeatureCall) featureCall.eContainer(); if (container.isExplicitStatic()) { return true; } return isDefiniteTypeLiteral(container); } return false; }
@Override protected ITextRegion getLocationOfContainmentReference(EObject owner, EReference reference, int indexInList, RegionDescription query) { if (owner instanceof XMemberFeatureCall && reference == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall casted = (XMemberFeatureCall) owner; if (casted.isExplicitStatic() || casted.isStaticWithDeclaringType()) { XExpression target = ((XMemberFeatureCall) owner).getMemberCallTarget(); return getTextRegion(target, query); } } return super.getLocationOfContainmentReference(owner, reference, indexInList, query); }
/** * Returns the node that best describes the error, e.g. if there is an expression * <code>com::foo::DoesNotExist::method()</code> the error will be rooted at <code>com</code>, but * the real problem is <code>com::foo::DoesNotExist</code>. */ private INode getErrorNode(XExpression expression, INode node) { if (expression instanceof XFeatureCall) { XFeatureCall featureCall = (XFeatureCall) expression; if (!canBeTypeLiteral(featureCall)) { return node; } if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall container = (XMemberFeatureCall) featureCall.eContainer(); if (canBeTypeLiteral(container)) { boolean explicitStatic = container.isExplicitStatic(); XMemberFeatureCall outerMost = getLongestTypeLiteralCandidate(container, explicitStatic); if (outerMost != null) return NodeModelUtils.getNode(outerMost); } } } return node; }
protected void _visit(final XMemberFeatureCall semanticObj, final INode originNode, final ImportsAcceptor acceptor) { if (((semanticObj.getFeature() instanceof JvmType) && semanticObj.isTypeLiteral())) { JvmIdentifiableElement _feature = semanticObj.getFeature(); this.visit(((JvmType) _feature), originNode, acceptor); } boolean _isExplicitStatic = semanticObj.isExplicitStatic(); boolean _not = (!_isExplicitStatic); if (_not) { final XExpression target = semanticObj.getMemberCallTarget(); if ((target instanceof XAbstractFeatureCall)) { boolean _isTypeLiteral = ((XAbstractFeatureCall)target).isTypeLiteral(); if (_isTypeLiteral) { return; } } this.collectStaticImportsFrom(semanticObj, acceptor); } }
protected boolean isPotentialTypeLiteralImpl(XExpression featureCall, /* @Nullable */ IResolvedTypes resolvedTypes, boolean staticNotation) { if (featureCall instanceof XMemberFeatureCall) { XMemberFeatureCall casted = (XMemberFeatureCall) featureCall; if (casted.isExplicitOperationCallOrBuilderSyntax() || casted.isNullSafe()) { return false; } XExpression target = casted.getMemberCallTarget(); if (casted.isExplicitStatic() != staticNotation) { return false; } return isPotentialTypeLiteralImpl(target, resolvedTypes, staticNotation); } if (featureCall instanceof XFeatureCall) { XFeatureCall casted = (XFeatureCall) featureCall; if (casted.isExplicitOperationCallOrBuilderSyntax()) { return false; } if (resolvedTypes == null) return true; LightweightTypeReference knownType = resolvedTypes.getActualType(casted); if (knownType == null || knownType.isUnknown()) { return true; } } return false; }
else if (featureCall.isExplicitStatic()) acceptor.accept(memberFeatureCallElements.getExplicitStaticColonColonKeyword_1_1_0_0_1_2_0());
if (!featureCall.isExplicitStatic()) { XExpression target = featureCall.getMemberCallTarget(); if (!isTypeLiteral(target) || featureCall.isExtension()) {
IScope root = createTypeLiteralScope(featureCall, receiver, session, resolvedTypes, receiverType, linkedReceiver); if (root != null) { if (featureCall instanceof XMemberFeatureCall && ((XMemberFeatureCall) featureCall).isExplicitStatic()) { return root;
boolean _isExplicitStatic = it.isExplicitStatic(); if (_isExplicitStatic) { _matched=true;
boolean _isExplicitStatic = it.isExplicitStatic(); if (_isExplicitStatic) { _matched=true;