Search in sources :

Example 96 with XFeatureCall

use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.

the class ExtractMethodRefactoring method checkInitialConditions.

@Override
public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
    StatusWrapper status = statusProvider.get();
    IResolvedTypes resolvedTypes = typeResolver.resolveTypes(firstExpression, new CancelIndicator() {

        @Override
        public boolean isCanceled() {
            return pm.isCanceled();
        }
    });
    try {
        Set<String> calledExternalFeatureNames = newHashSet();
        returnType = calculateReturnType(resolvedTypes);
        if (returnType != null && !equal("void", returnType.getIdentifier()))
            returnExpression = lastExpression;
        boolean isReturnAllowed = isEndOfOriginalMethod();
        for (EObject element : EcoreUtil2.eAllContents(originalMethod.getExpression())) {
            if (pm.isCanceled()) {
                throw new OperationCanceledException();
            }
            boolean isLocalExpression = EcoreUtil.isAncestor(expressions, element);
            if (element instanceof XFeatureCall) {
                XFeatureCall featureCall = (XFeatureCall) element;
                JvmIdentifiableElement feature = featureCall.getFeature();
                LightweightTypeReference featureType = resolvedTypes.getActualType(featureCall);
                boolean isLocalFeature = EcoreUtil.isAncestor(expressions, feature);
                if (!isLocalFeature && isLocalExpression) {
                    // call-out
                    if (feature instanceof JvmFormalParameter || feature instanceof XVariableDeclaration) {
                        if (!calledExternalFeatureNames.contains(feature.getSimpleName())) {
                            calledExternalFeatureNames.add(feature.getSimpleName());
                            ParameterInfo parameterInfo = new ParameterInfo(featureType.getIdentifier(), feature.getSimpleName(), parameterInfos.size());
                            parameterInfos.add(parameterInfo);
                            parameter2type.put(parameterInfo, featureType);
                        }
                        externalFeatureCalls.put(feature.getSimpleName(), featureCall);
                    }
                } else if (isLocalFeature && !isLocalExpression) {
                    // call-in
                    if (returnExpression != null) {
                        status.add(RefactoringStatus.FATAL, "Ambiguous return value: Multiple local variables are accessed in subsequent code.");
                        break;
                    }
                    returnExpression = featureCall;
                    returnType = featureType;
                }
            } else if (isLocalExpression) {
                if (element instanceof XReturnExpression && !isReturnAllowed) {
                    status.add(RefactoringStatus.FATAL, "Extracting method would break control flow due to return statements.");
                    break;
                } else if (element instanceof JvmTypeReference) {
                    JvmType type = ((JvmTypeReference) element).getType();
                    if (type instanceof JvmTypeParameter) {
                        JvmOperation operation = associations.getDirectlyInferredOperation(originalMethod);
                        if (operation != null) {
                            List<JvmTypeParameter> typeParameters = operation.getTypeParameters();
                            if (typeParameters.contains(type))
                                neededTypeParameters.add((JvmTypeParameter) type);
                        }
                    }
                } else if (element instanceof JvmFormalParameter)
                    localFeatureNames.add(((JvmFormalParameter) element).getName());
                else if (element instanceof XVariableDeclaration)
                    localFeatureNames.add(((XVariableDeclaration) element).getIdentifier());
            }
        }
    } catch (OperationCanceledException e) {
        throw e;
    } catch (Exception exc) {
        handleException(exc, status);
    }
    return status.getRefactoringStatus();
}
Also used : XVariableDeclaration(org.eclipse.xtext.xbase.XVariableDeclaration) LightweightTypeReference(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference) JvmIdentifiableElement(org.eclipse.xtext.common.types.JvmIdentifiableElement) IResolvedTypes(org.eclipse.xtext.xbase.typesystem.IResolvedTypes) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) StatusWrapper(org.eclipse.xtext.ui.refactoring.impl.StatusWrapper) RichString(org.eclipse.xtend.core.xtend.RichString) ParameterInfo(org.eclipse.jdt.internal.corext.refactoring.ParameterInfo) JvmType(org.eclipse.xtext.common.types.JvmType) CoreException(org.eclipse.core.runtime.CoreException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) BadLocationException(org.eclipse.jface.text.BadLocationException) JvmOperation(org.eclipse.xtext.common.types.JvmOperation) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) EObject(org.eclipse.emf.ecore.EObject) CancelIndicator(org.eclipse.xtext.util.CancelIndicator) XReturnExpression(org.eclipse.xtext.xbase.XReturnExpression)

Example 97 with XFeatureCall

use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.

the class ExtractMethodRefactoring method createMethodCallEdit.

protected void createMethodCallEdit(DocumentRewriter.Section methodCallSection, ITextRegion expressionRegion) throws BadLocationException {
    if (firstExpression.eContainer() instanceof RichString) {
        methodCallSection.append("�");
    }
    if (isNeedsReturnExpression()) {
        JvmIdentifiableElement returnFeature = ((XFeatureCall) returnExpression).getFeature();
        if (isFinalFeature(returnFeature))
            methodCallSection.append("val ");
        else
            methodCallSection.append("var ");
        methodCallSection.append(returnFeature.getSimpleName()).append(" = ");
    }
    boolean needsSurroundingParentheses = false;
    if (firstExpression.eContainer() instanceof XMemberFeatureCall) {
        if (((XMemberFeatureCall) firstExpression.eContainer()).getMemberCallArguments().size() == 1) {
            String expressionExpanded = document.get(expressionRegion.getOffset() - 1, expressionRegion.getLength() + 2);
            if (!expressionExpanded.startsWith("(") || !expressionExpanded.endsWith(")")) {
                needsSurroundingParentheses = true;
                methodCallSection.append("(");
            }
        }
    }
    methodCallSection.append(methodName).append("(");
    boolean isFirst = true;
    for (ParameterInfo parameterInfo : getParameterInfos()) {
        if (!isFirst)
            methodCallSection.append(", ");
        isFirst = false;
        methodCallSection.append(parameterInfo.getOldName());
    }
    methodCallSection.append(")");
    if (needsSurroundingParentheses)
        methodCallSection.append(")");
    if (lastExpression.eContainer() instanceof RichString) {
        methodCallSection.append("�");
    }
}
Also used : RichString(org.eclipse.xtend.core.xtend.RichString) JvmIdentifiableElement(org.eclipse.xtext.common.types.JvmIdentifiableElement) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) XMemberFeatureCall(org.eclipse.xtext.xbase.XMemberFeatureCall) RichString(org.eclipse.xtend.core.xtend.RichString) ParameterInfo(org.eclipse.jdt.internal.corext.refactoring.ParameterInfo)

Example 98 with XFeatureCall

use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-xtend by eclipse.

the class ExtractMethodRefactoring method getMethodBodyWithRenamedParameters.

protected String getMethodBodyWithRenamedParameters(ITextRegion expressionsRegion) throws BadLocationException {
    String expressionsAsString = document.get(expressionsRegion.getOffset(), expressionsRegion.getLength());
    List<ReplaceRegion> parameterRenames = newArrayList();
    for (final String parameterName : externalFeatureCalls.keySet()) {
        ParameterInfo parameter = find(parameterInfos, new Predicate<ParameterInfo>() {

            @Override
            public boolean apply(ParameterInfo info) {
                return equal(info.getOldName(), parameterName);
            }
        });
        if (parameter.isRenamed()) {
            for (XFeatureCall featureCall : externalFeatureCalls.get(parameterName)) {
                ITextRegion textRegion = locationInFileProvider.getSignificantTextRegion(featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, -1);
                parameterRenames.add(new ReplaceRegion(textRegion, parameter.getNewName()));
            }
        }
    }
    sort(parameterRenames, new Comparator<ReplaceRegion>() {

        @Override
        public int compare(ReplaceRegion o1, ReplaceRegion o2) {
            return o2.getOffset() - o1.getOffset();
        }
    });
    StringBuffer buffer = new StringBuffer(expressionsAsString);
    for (ReplaceRegion parameterRename : parameterRenames) {
        buffer.replace(parameterRename.getOffset() - expressionsRegion.getOffset(), parameterRename.getEndOffset() - expressionsRegion.getOffset(), parameterRename.getText());
    }
    expressionsAsString = buffer.toString();
    return expressionsAsString;
}
Also used : ReplaceRegion(org.eclipse.xtext.util.ReplaceRegion) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) ITextRegion(org.eclipse.xtext.util.ITextRegion) RichString(org.eclipse.xtend.core.xtend.RichString) ParameterInfo(org.eclipse.jdt.internal.corext.refactoring.ParameterInfo)

Example 99 with XFeatureCall

use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-eclipse by eclipse.

the class XbaseProposalProvider method completeWithinBlock.

protected void completeWithinBlock(EObject model, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    ICompositeNode node = NodeModelUtils.getNode(model);
    if (node.getOffset() >= context.getOffset()) {
        createLocalVariableAndImplicitProposals(model, IExpressionScope.Anchor.BEFORE, context, acceptor);
        return;
    }
    if (model instanceof XBlockExpression) {
        List<XExpression> children = ((XBlockExpression) model).getExpressions();
        if (!children.isEmpty()) {
            for (int i = children.size() - 1; i >= 0; i--) {
                XExpression child = children.get(i);
                ICompositeNode childNode = NodeModelUtils.getNode(child);
                if (childNode.getEndOffset() <= context.getOffset()) {
                    createLocalVariableAndImplicitProposals(child, IExpressionScope.Anchor.AFTER, context, acceptor);
                    return;
                }
            }
        }
    }
    int endOffset = node.getEndOffset();
    if (endOffset <= context.getOffset()) {
        if (model instanceof XFeatureCall && model.eContainer() instanceof XClosure || endOffset == context.getOffset() && context.getPrefix().length() == 0)
            return;
        if (isInMemberFeatureCall(model, endOffset, context))
            return;
        createLocalVariableAndImplicitProposals(model, IExpressionScope.Anchor.AFTER, context, acceptor);
        return;
    } else if (isInMemberFeatureCall(model, endOffset, context)) {
        return;
    }
    if (model instanceof XClosure)
        return;
    createLocalVariableAndImplicitProposals(model, IExpressionScope.Anchor.BEFORE, context, acceptor);
}
Also used : XBlockExpression(org.eclipse.xtext.xbase.XBlockExpression) XClosure(org.eclipse.xtext.xbase.XClosure) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) XExpression(org.eclipse.xtext.xbase.XExpression)

Example 100 with XFeatureCall

use of org.eclipse.xtext.xbase.XFeatureCall in project xtext-eclipse by eclipse.

the class AbstractDomainmodelSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == DomainmodelPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case DomainmodelPackage.DOMAIN_MODEL:
                sequence_DomainModel(context, (DomainModel) semanticObject);
                return;
            case DomainmodelPackage.ENTITY:
                sequence_Entity(context, (Entity) semanticObject);
                return;
            case DomainmodelPackage.OPERATION:
                sequence_Operation(context, (Operation) semanticObject);
                return;
            case DomainmodelPackage.PACKAGE_DECLARATION:
                sequence_PackageDeclaration(context, (PackageDeclaration) semanticObject);
                return;
            case DomainmodelPackage.PROPERTY:
                sequence_Property(context, (Property) semanticObject);
                return;
        }
    else if (epackage == TypesPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case TypesPackage.JVM_FORMAL_PARAMETER:
                if (rule == grammarAccess.getFullJvmFormalParameterRule()) {
                    sequence_FullJvmFormalParameter(context, (JvmFormalParameter) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmFormalParameterRule()) {
                    sequence_JvmFormalParameter(context, (JvmFormalParameter) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_GENERIC_ARRAY_TYPE_REFERENCE:
                sequence_JvmTypeReference(context, (JvmGenericArrayTypeReference) semanticObject);
                return;
            case TypesPackage.JVM_INNER_TYPE_REFERENCE:
                sequence_JvmParameterizedTypeReference(context, (JvmInnerTypeReference) semanticObject);
                return;
            case TypesPackage.JVM_LOWER_BOUND:
                if (rule == grammarAccess.getJvmLowerBoundAndedRule()) {
                    sequence_JvmLowerBoundAnded(context, (JvmLowerBound) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmLowerBoundRule()) {
                    sequence_JvmLowerBound(context, (JvmLowerBound) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_PARAMETERIZED_TYPE_REFERENCE:
                if (action == grammarAccess.getJvmParameterizedTypeReferenceAccess().getJvmInnerTypeReferenceOuterAction_1_4_0_0_0()) {
                    sequence_JvmParameterizedTypeReference_JvmInnerTypeReference_1_4_0_0_0(context, (JvmParameterizedTypeReference) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmTypeReferenceRule() || action == grammarAccess.getJvmTypeReferenceAccess().getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0() || rule == grammarAccess.getJvmParameterizedTypeReferenceRule() || rule == grammarAccess.getJvmArgumentTypeReferenceRule()) {
                    sequence_JvmParameterizedTypeReference(context, (JvmParameterizedTypeReference) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_TYPE_PARAMETER:
                sequence_JvmTypeParameter(context, (JvmTypeParameter) semanticObject);
                return;
            case TypesPackage.JVM_UPPER_BOUND:
                if (rule == grammarAccess.getJvmUpperBoundAndedRule()) {
                    sequence_JvmUpperBoundAnded(context, (JvmUpperBound) semanticObject);
                    return;
                } else if (rule == grammarAccess.getJvmUpperBoundRule()) {
                    sequence_JvmUpperBound(context, (JvmUpperBound) semanticObject);
                    return;
                } else
                    break;
            case TypesPackage.JVM_WILDCARD_TYPE_REFERENCE:
                sequence_JvmWildcardTypeReference(context, (JvmWildcardTypeReference) semanticObject);
                return;
        }
    else if (epackage == XbasePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XbasePackage.XASSIGNMENT:
                sequence_XAssignment_XMemberFeatureCall(context, (XAssignment) semanticObject);
                return;
            case XbasePackage.XBASIC_FOR_LOOP_EXPRESSION:
                sequence_XBasicForLoopExpression(context, (XBasicForLoopExpression) semanticObject);
                return;
            case XbasePackage.XBINARY_OPERATION:
                sequence_XAdditiveExpression_XAndExpression_XAssignment_XEqualityExpression_XMultiplicativeExpression_XOrExpression_XOtherOperatorExpression_XRelationalExpression(context, (XBinaryOperation) semanticObject);
                return;
            case XbasePackage.XBLOCK_EXPRESSION:
                if (rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXPrimaryExpressionRule() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXBlockExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XBlockExpression(context, (XBlockExpression) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXExpressionInClosureRule()) {
                    sequence_XExpressionInClosure(context, (XBlockExpression) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XBOOLEAN_LITERAL:
                sequence_XBooleanLiteral(context, (XBooleanLiteral) semanticObject);
                return;
            case XbasePackage.XCASE_PART:
                sequence_XCasePart(context, (XCasePart) semanticObject);
                return;
            case XbasePackage.XCASTED_EXPRESSION:
                sequence_XCastedExpression(context, (XCastedExpression) semanticObject);
                return;
            case XbasePackage.XCATCH_CLAUSE:
                sequence_XCatchClause(context, (XCatchClause) semanticObject);
                return;
            case XbasePackage.XCLOSURE:
                if (rule == grammarAccess.getXExpressionRule() || rule == grammarAccess.getXAssignmentRule() || action == grammarAccess.getXAssignmentAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOrExpressionRule() || action == grammarAccess.getXOrExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAndExpressionRule() || action == grammarAccess.getXAndExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXEqualityExpressionRule() || action == grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXRelationalExpressionRule() || action == grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0() || action == grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0() || rule == grammarAccess.getXOtherOperatorExpressionRule() || action == grammarAccess.getXOtherOperatorExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXAdditiveExpressionRule() || action == grammarAccess.getXAdditiveExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXMultiplicativeExpressionRule() || action == grammarAccess.getXMultiplicativeExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0() || rule == grammarAccess.getXUnaryOperationRule() || rule == grammarAccess.getXCastedExpressionRule() || action == grammarAccess.getXCastedExpressionAccess().getXCastedExpressionTargetAction_1_0_0_0() || rule == grammarAccess.getXPostfixOperationRule() || action == grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0() || rule == grammarAccess.getXMemberFeatureCallRule() || action == grammarAccess.getXMemberFeatureCallAccess().getXAssignmentAssignableAction_1_0_0_0_0() || action == grammarAccess.getXMemberFeatureCallAccess().getXMemberFeatureCallMemberCallTargetAction_1_1_0_0_0() || rule == grammarAccess.getXPrimaryExpressionRule() || rule == grammarAccess.getXLiteralRule() || rule == grammarAccess.getXClosureRule() || rule == grammarAccess.getXParenthesizedExpressionRule() || rule == grammarAccess.getXExpressionOrVarDeclarationRule()) {
                    sequence_XClosure(context, (XClosure) semanticObject);
                    return;
                } else if (rule == grammarAccess.getXShortClosureRule()) {
                    sequence_XShortClosure(context, (XClosure) semanticObject);
                    return;
                } else
                    break;
            case XbasePackage.XCONSTRUCTOR_CALL:
                sequence_XConstructorCall(context, (XConstructorCall) semanticObject);
                return;
            case XbasePackage.XDO_WHILE_EXPRESSION:
                sequence_XDoWhileExpression(context, (XDoWhileExpression) semanticObject);
                return;
            case XbasePackage.XFEATURE_CALL:
                sequence_XFeatureCall(context, (XFeatureCall) semanticObject);
                return;
            case XbasePackage.XFOR_LOOP_EXPRESSION:
                sequence_XForLoopExpression(context, (XForLoopExpression) semanticObject);
                return;
            case XbasePackage.XIF_EXPRESSION:
                sequence_XIfExpression(context, (XIfExpression) semanticObject);
                return;
            case XbasePackage.XINSTANCE_OF_EXPRESSION:
                sequence_XRelationalExpression(context, (XInstanceOfExpression) semanticObject);
                return;
            case XbasePackage.XLIST_LITERAL:
                sequence_XListLiteral(context, (XListLiteral) semanticObject);
                return;
            case XbasePackage.XMEMBER_FEATURE_CALL:
                sequence_XMemberFeatureCall(context, (XMemberFeatureCall) semanticObject);
                return;
            case XbasePackage.XNULL_LITERAL:
                sequence_XNullLiteral(context, (XNullLiteral) semanticObject);
                return;
            case XbasePackage.XNUMBER_LITERAL:
                sequence_XNumberLiteral(context, (XNumberLiteral) semanticObject);
                return;
            case XbasePackage.XPOSTFIX_OPERATION:
                sequence_XPostfixOperation(context, (XPostfixOperation) semanticObject);
                return;
            case XbasePackage.XRETURN_EXPRESSION:
                sequence_XReturnExpression(context, (XReturnExpression) semanticObject);
                return;
            case XbasePackage.XSET_LITERAL:
                sequence_XSetLiteral(context, (XSetLiteral) semanticObject);
                return;
            case XbasePackage.XSTRING_LITERAL:
                sequence_XStringLiteral(context, (XStringLiteral) semanticObject);
                return;
            case XbasePackage.XSWITCH_EXPRESSION:
                sequence_XSwitchExpression(context, (XSwitchExpression) semanticObject);
                return;
            case XbasePackage.XSYNCHRONIZED_EXPRESSION:
                sequence_XSynchronizedExpression(context, (XSynchronizedExpression) semanticObject);
                return;
            case XbasePackage.XTHROW_EXPRESSION:
                sequence_XThrowExpression(context, (XThrowExpression) semanticObject);
                return;
            case XbasePackage.XTRY_CATCH_FINALLY_EXPRESSION:
                sequence_XTryCatchFinallyExpression(context, (XTryCatchFinallyExpression) semanticObject);
                return;
            case XbasePackage.XTYPE_LITERAL:
                sequence_XTypeLiteral(context, (XTypeLiteral) semanticObject);
                return;
            case XbasePackage.XUNARY_OPERATION:
                sequence_XUnaryOperation(context, (XUnaryOperation) semanticObject);
                return;
            case XbasePackage.XVARIABLE_DECLARATION:
                sequence_XVariableDeclaration(context, (XVariableDeclaration) semanticObject);
                return;
            case XbasePackage.XWHILE_EXPRESSION:
                sequence_XWhileExpression(context, (XWhileExpression) semanticObject);
                return;
        }
    else if (epackage == XtypePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XtypePackage.XFUNCTION_TYPE_REF:
                sequence_XFunctionTypeRef(context, (XFunctionTypeRef) semanticObject);
                return;
            case XtypePackage.XIMPORT_DECLARATION:
                sequence_XImportDeclaration(context, (XImportDeclaration) semanticObject);
                return;
            case XtypePackage.XIMPORT_SECTION:
                sequence_XImportSection(context, (XImportSection) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : XCatchClause(org.eclipse.xtext.xbase.XCatchClause) XDoWhileExpression(org.eclipse.xtext.xbase.XDoWhileExpression) ParserRule(org.eclipse.xtext.ParserRule) Entity(org.eclipse.xtext.example.domainmodel.domainmodel.Entity) Action(org.eclipse.xtext.Action) XBasicForLoopExpression(org.eclipse.xtext.xbase.XBasicForLoopExpression) DomainModel(org.eclipse.xtext.example.domainmodel.domainmodel.DomainModel) XClosure(org.eclipse.xtext.xbase.XClosure) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) XPostfixOperation(org.eclipse.xtext.xbase.XPostfixOperation) XSwitchExpression(org.eclipse.xtext.xbase.XSwitchExpression) XBinaryOperation(org.eclipse.xtext.xbase.XBinaryOperation) XBinaryOperation(org.eclipse.xtext.xbase.XBinaryOperation) XUnaryOperation(org.eclipse.xtext.xbase.XUnaryOperation) Operation(org.eclipse.xtext.example.domainmodel.domainmodel.Operation) XPostfixOperation(org.eclipse.xtext.xbase.XPostfixOperation) XListLiteral(org.eclipse.xtext.xbase.XListLiteral) EPackage(org.eclipse.emf.ecore.EPackage) XInstanceOfExpression(org.eclipse.xtext.xbase.XInstanceOfExpression) XIfExpression(org.eclipse.xtext.xbase.XIfExpression) XMemberFeatureCall(org.eclipse.xtext.xbase.XMemberFeatureCall) XCasePart(org.eclipse.xtext.xbase.XCasePart) XForLoopExpression(org.eclipse.xtext.xbase.XForLoopExpression) XNumberLiteral(org.eclipse.xtext.xbase.XNumberLiteral) Property(org.eclipse.xtext.example.domainmodel.domainmodel.Property) XReturnExpression(org.eclipse.xtext.xbase.XReturnExpression) PackageDeclaration(org.eclipse.xtext.example.domainmodel.domainmodel.PackageDeclaration) XAssignment(org.eclipse.xtext.xbase.XAssignment) XThrowExpression(org.eclipse.xtext.xbase.XThrowExpression) XBlockExpression(org.eclipse.xtext.xbase.XBlockExpression) XCastedExpression(org.eclipse.xtext.xbase.XCastedExpression) XVariableDeclaration(org.eclipse.xtext.xbase.XVariableDeclaration) XStringLiteral(org.eclipse.xtext.xbase.XStringLiteral) JvmLowerBound(org.eclipse.xtext.common.types.JvmLowerBound) XSetLiteral(org.eclipse.xtext.xbase.XSetLiteral) XConstructorCall(org.eclipse.xtext.xbase.XConstructorCall) XTypeLiteral(org.eclipse.xtext.xbase.XTypeLiteral) JvmUpperBound(org.eclipse.xtext.common.types.JvmUpperBound) XSynchronizedExpression(org.eclipse.xtext.xbase.XSynchronizedExpression) XBooleanLiteral(org.eclipse.xtext.xbase.XBooleanLiteral) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) XNullLiteral(org.eclipse.xtext.xbase.XNullLiteral) XUnaryOperation(org.eclipse.xtext.xbase.XUnaryOperation) XWhileExpression(org.eclipse.xtext.xbase.XWhileExpression) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) JvmTypeParameter(org.eclipse.xtext.common.types.JvmTypeParameter) Parameter(org.eclipse.xtext.Parameter) XTryCatchFinallyExpression(org.eclipse.xtext.xbase.XTryCatchFinallyExpression) JvmParameterizedTypeReference(org.eclipse.xtext.common.types.JvmParameterizedTypeReference)

Aggregations

XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)101 Test (org.junit.Test)84 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)75 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)73 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)62 JvmIdentifiableElement (org.eclipse.xtext.common.types.JvmIdentifiableElement)30 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)29 XMemberFeatureCall (org.eclipse.xtext.xbase.XMemberFeatureCall)22 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)20 XExpression (org.eclipse.xtext.xbase.XExpression)15 XAbstractFeatureCall (org.eclipse.xtext.xbase.XAbstractFeatureCall)8 RichString (org.eclipse.xtend.core.xtend.RichString)7 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)7 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)6 XAssignment (org.eclipse.xtext.xbase.XAssignment)6 XTryCatchFinallyExpression (org.eclipse.xtext.xbase.XTryCatchFinallyExpression)6 EObject (org.eclipse.emf.ecore.EObject)5 XtendConstructor (org.eclipse.xtend.core.xtend.XtendConstructor)5 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)5 XClosure (org.eclipse.xtext.xbase.XClosure)5