private boolean isTypeLiteral(XExpression memberCallTarget) { if (memberCallTarget instanceof XAbstractFeatureCall) { return ((XAbstractFeatureCall) memberCallTarget).isTypeLiteral(); } return false; }
protected boolean isTypeLiteral(XExpression expression) { return expression instanceof XAbstractFeatureCall && ((XAbstractFeatureCall) expression).isTypeLiteral(); }
protected boolean _isValidAnnotationValue(final XAbstractFeatureCall expression) { boolean _isTypeLiteral = expression.isTypeLiteral(); if (_isTypeLiteral) { return true; } return super.isConstant(expression); }
@Override public boolean isTypeLiteral() { XAbstractFeatureCall featureCall = getFeatureCall(); return featureCall.isTypeLiteral(); } }
@Override public boolean isTypeLiteral() { return getFeatureCall().isTypeLiteral(); }
protected void highlightFeatureCall(XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor, String id) { // highlightDeprecation(acceptor, featureCall, null, featureCall.getFeature()); if (featureCall.isTypeLiteral()) { ICompositeNode node = NodeModelUtils.findActualNodeFor(featureCall); highlightNode(acceptor, node, id); } else { highlightFeature(acceptor, featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, id); } }
protected IScope getTypeScope(XAbstractFeatureCall call, JvmType type) { if (call.isTypeLiteral() || call.isPackageFragment()) { return doGetTypeScope(call, type); } return getThisOrSuperScope(call, type); }
/** Generate a feature call. * * @param expr the call expression. */ public void generate(XAbstractFeatureCall expr) { if (expr.isTypeLiteral()) { final JvmType type = (JvmType) expr.getFeature(); this.codeReceiver.append(type); //} else if (getExpressionHelper().isShortCircuitOperation(expr)) { // generateShortCircuitInvocation(expr); } else { if (expr instanceof XMemberFeatureCall && ((XMemberFeatureCall) expr).isNullSafe()) { featureCalltoJavaExpression(expr, () -> expr); } else { featureCalltoJavaExpression(expr, null); } } }
@Override public ITextRegion getSignificantTextRegion(EObject element) { if (element instanceof XAbstractFeatureCall) { XAbstractFeatureCall typeLiteral = typeLiteralHelper.getRootTypeLiteral((XAbstractFeatureCall) element); if (typeLiteral != null) { if (typeLiteral instanceof XMemberFeatureCall) { XAbstractFeatureCall target = (XAbstractFeatureCall) ((XMemberFeatureCall) typeLiteral).getMemberCallTarget(); if (target.isTypeLiteral()) { return super.getSignificantTextRegion(typeLiteral); } } INode node = NodeModelUtils.findActualNodeFor(typeLiteral); if (node != null) { return toZeroBasedRegion(node.getTextRegionWithLineInformation()); } } } return super.getSignificantTextRegion(element); }
protected void _toJavaExpression(XAbstractFeatureCall call, ITreeAppendable b) { if (call.isTypeLiteral()) { b.append((JvmType) call.getFeature()).append(".class"); } else if (isPrimitiveVoid(call)) { throw new IllegalArgumentException("feature yields 'void'"); } else { final String referenceName = getReferenceName(call, b); if (referenceName != null) { if (call instanceof XFeatureCall || call instanceof XMemberFeatureCall) { b.trace(call, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, 0).append(referenceName); } else { b.trace(call, false).append(referenceName); } } else { featureCalltoJavaExpression(call, b, true); } } }
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); } }
private static boolean isLocalExpression(XAbstractFeatureCall expression, ISideEffectContext context, boolean dereference) { if (expression.isTypeLiteral() || expression.isPackageFragment()) { return false; } final JvmIdentifiableElement feature = expression.getFeature(); if (feature != null && (feature.eIsProxy() || isExternalFeature(feature))) { return false; } if (feature instanceof XVariableDeclaration) { if (dereference) { final XVariableDeclaration variable = (XVariableDeclaration) feature; for (final XExpression value : context.getVariableValues(variable.getIdentifier())) { if (!isLocalExpression(value, context, dereference)) { return false; } } } } return true; }
return true; if (featureCall.isPackageFragment() || featureCall.isTypeLiteral()) { return false;
boolean _matched_1 = false; if (receiver instanceof XAbstractFeatureCall) { boolean _isTypeLiteral = ((XAbstractFeatureCall)receiver).isTypeLiteral(); if (_isTypeLiteral) { _matched_1=true; boolean _isTypeLiteral = ((XAbstractFeatureCall)expression).isTypeLiteral(); if (_isTypeLiteral) { _matched=true;
public XAbstractFeatureCall getRootTypeLiteral(XAbstractFeatureCall featureCall) { if (featureCall.isTypeLiteral()) { return featureCall; } if (featureCall.isPackageFragment()) { return getRootTypeLiteral((XAbstractFeatureCall) featureCall.eContainer()); } if (featureCall.getFeature() == null || featureCall.getFeature().eIsProxy()) { // syntactic check if (featureCall instanceof XFeatureCall || featureCall instanceof XMemberFeatureCall) { if (!isPotentialTypeLiteral(featureCall, null)) { return null; } if (featureCall instanceof XMemberFeatureCall) { return doGetRootTypeLiteral((XMemberFeatureCall) featureCall); } if (featureCall instanceof XFeatureCall) { if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { return doGetRootTypeLiteral((XMemberFeatureCall) featureCall.eContainer()); } } } } return null; }
return false; if (expression.isTypeLiteral() || expression.isPackageFragment()) { return false;
protected void checkNoJavaStyleTypeCasting(INode node) { BidiTreeIterator<INode> iterator = node.getAsTreeIterable().reverse().iterator(); ILeafNode child = getFirstLeafNode(iterator); if (child != null && child.getGrammarElement() == grammarAccess.getXParenthesizedExpressionAccess().getRightParenthesisKeyword_2()) { INode expressionNode = getNode(iterator, grammarAccess.getXParenthesizedExpressionAccess().getXExpressionParserRuleCall_1()); EObject semanticObject = NodeModelUtils.findActualSemanticObjectFor(expressionNode); if (semanticObject instanceof XFeatureCall || semanticObject instanceof XMemberFeatureCall) { XAbstractFeatureCall featureCall = (XAbstractFeatureCall) semanticObject; if (featureCall.isTypeLiteral()) { ICompositeNode parenthesizedNode = child.getParent(); ITextRegion parenthesizedRegion = parenthesizedNode.getTextRegion(); addIssue("Use 'as' keyword for type casting.", featureCall, parenthesizedRegion.getOffset(), parenthesizedRegion.getLength(), JAVA_STYLE_TYPE_CAST); } } } }
if (featureCall.isTypeLiteral() || featureCall.isPackageFragment()) { return false;
protected IFeatureLinkingCandidate createResolvedLink(XAbstractFeatureCall featureCall, JvmIdentifiableElement resolvedTo) { ExpressionAwareStackedResolvedTypes resolvedTypes = this.resolvedTypes.pushTypes(featureCall); ExpressionTypeComputationState state = createExpressionComputationState(featureCall, resolvedTypes); FeatureLinkHelper helper = new FeatureLinkHelper(); XExpression syntacticReceiver = helper.getSyntacticReceiver(featureCall); if (syntacticReceiver != null) { AbstractTypeComputationState child = state.withNonVoidExpectation(); child.computeTypes(syntacticReceiver); } XExpression implicitReceiver = featureCall.getImplicitReceiver(); if (implicitReceiver != null) { AbstractTypeComputationState child = state.withNonVoidExpectation(); child.computeTypes(implicitReceiver); } XExpression implicitFirstArgument = featureCall.getImplicitFirstArgument(); if (implicitFirstArgument != null) { AbstractTypeComputationState child = state.withNonVoidExpectation(); child.computeTypes(implicitFirstArgument); } if (featureCall.isTypeLiteral() || featureCall.isPackageFragment()) { return new ResolvedTypeLiteral(featureCall, resolvedTo, getSingleExpectation(state), state); } return new ResolvedFeature(featureCall, resolvedTo, helper, getSingleExpectation(state), state); }
protected void _toJavaStatement(final XAbstractFeatureCall expr, ITreeAppendable b, final boolean isReferenced) { if (expr.isTypeLiteral()) { generateComment(new Later() { @Override