Search in sources :

Example 1 with Operation

use of org.eclipse.xtext.example.domainmodel.domainmodel.Operation in project xtext-eclipse by eclipse.

the class DomainmodelParsingTest method testReturnTypeInference.

@Test
public void testReturnTypeInference() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package example {");
        _builder.newLine();
        _builder.append("  ");
        _builder.append("entity MyEntity {");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("property : String");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("op foo(String s) {");
        _builder.newLine();
        _builder.append("    \t");
        _builder.append("return property.toUpperCase + s");
        _builder.newLine();
        _builder.append("    ");
        _builder.append("}");
        _builder.newLine();
        _builder.append("  ");
        _builder.append("}");
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        final DomainModel model = this._parseHelper.parse(_builder);
        AbstractElement _head = IterableExtensions.<AbstractElement>head(model.getElements());
        final PackageDeclaration pack = ((PackageDeclaration) _head);
        AbstractElement _head_1 = IterableExtensions.<AbstractElement>head(pack.getElements());
        final Entity entity = ((Entity) _head_1);
        Feature _last = IterableExtensions.<Feature>last(entity.getFeatures());
        final Operation op = ((Operation) _last);
        EObject _head_2 = IterableExtensions.<EObject>head(this._iJvmModelAssociations.getJvmElements(op));
        final JvmOperation method = ((JvmOperation) _head_2);
        Assert.assertEquals("String", method.getReturnType().getSimpleName());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : JvmOperation(org.eclipse.xtext.common.types.JvmOperation) Entity(org.eclipse.xtext.example.domainmodel.domainmodel.Entity) DomainModel(org.eclipse.xtext.example.domainmodel.domainmodel.DomainModel) AbstractElement(org.eclipse.xtext.example.domainmodel.domainmodel.AbstractElement) EObject(org.eclipse.emf.ecore.EObject) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) JvmOperation(org.eclipse.xtext.common.types.JvmOperation) Operation(org.eclipse.xtext.example.domainmodel.domainmodel.Operation) Feature(org.eclipse.xtext.example.domainmodel.domainmodel.Feature) PackageDeclaration(org.eclipse.xtext.example.domainmodel.domainmodel.PackageDeclaration) Test(org.junit.Test)

Example 2 with Operation

use of org.eclipse.xtext.example.domainmodel.domainmodel.Operation in project xtext-eclipse by eclipse.

the class DomainmodelJvmModelInferrer method _infer.

protected void _infer(final Entity entity, @Extension final IJvmDeclaredTypeAcceptor acceptor, final boolean prelinkingPhase) {
    final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
        this._jvmTypesBuilder.setDocumentation(it, this._jvmTypesBuilder.getDocumentation(entity));
        JvmParameterizedTypeReference _superType = entity.getSuperType();
        boolean _tripleNotEquals = (_superType != null);
        if (_tripleNotEquals) {
            EList<JvmTypeReference> _superTypes = it.getSuperTypes();
            JvmTypeReference _cloneWithProxies = this._jvmTypesBuilder.cloneWithProxies(entity.getSuperType());
            this._jvmTypesBuilder.<JvmTypeReference>operator_add(_superTypes, _cloneWithProxies);
        }
        EList<JvmMember> _members = it.getMembers();
        final Procedure1<JvmConstructor> _function_1 = (JvmConstructor it_1) -> {
        };
        JvmConstructor _constructor = this._jvmTypesBuilder.toConstructor(entity, _function_1);
        this._jvmTypesBuilder.<JvmConstructor>operator_add(_members, _constructor);
        final JvmTypeReference procedureType = this._typeReferenceBuilder.typeRef(Procedure1.class, this._typeReferenceBuilder.typeRef(it));
        EList<JvmMember> _members_1 = it.getMembers();
        final Procedure1<JvmConstructor> _function_2 = (JvmConstructor it_1) -> {
            EList<JvmFormalParameter> _parameters = it_1.getParameters();
            JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(entity, "initializer", procedureType);
            this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
            StringConcatenationClient _client = new StringConcatenationClient() {

                @Override
                protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
                    _builder.append("initializer.apply(this);");
                    _builder.newLine();
                }
            };
            this._jvmTypesBuilder.setBody(it_1, _client);
        };
        JvmConstructor _constructor_1 = this._jvmTypesBuilder.toConstructor(entity, _function_2);
        this._jvmTypesBuilder.<JvmConstructor>operator_add(_members_1, _constructor_1);
        EList<Feature> _features = entity.getFeatures();
        for (final Feature f : _features) {
            boolean _matched = false;
            if (f instanceof Property) {
                _matched = true;
                final JvmField field = this._jvmTypesBuilder.toField(f, ((Property) f).getName(), ((Property) f).getType());
                EList<JvmMember> _members_2 = it.getMembers();
                this._jvmTypesBuilder.<JvmField>operator_add(_members_2, field);
                EList<JvmMember> _members_3 = it.getMembers();
                JvmOperation _getter = this._jvmTypesBuilder.toGetter(f, ((Property) f).getName(), ((Property) f).getType());
                this._jvmTypesBuilder.<JvmOperation>operator_add(_members_3, _getter);
                EList<JvmMember> _members_4 = it.getMembers();
                JvmOperation _setter = this._jvmTypesBuilder.toSetter(f, ((Property) f).getName(), ((Property) f).getType());
                this._jvmTypesBuilder.<JvmOperation>operator_add(_members_4, _setter);
            }
            if (!_matched) {
                if (f instanceof Operation) {
                    _matched = true;
                    EList<JvmMember> _members_2 = it.getMembers();
                    String _name = ((Operation) f).getName();
                    JvmTypeReference _elvis = null;
                    JvmTypeReference _type = ((Operation) f).getType();
                    if (_type != null) {
                        _elvis = _type;
                    } else {
                        JvmTypeReference _inferredType = this._jvmTypesBuilder.inferredType();
                        _elvis = _inferredType;
                    }
                    final Procedure1<JvmOperation> _function_3 = (JvmOperation it_1) -> {
                        this._jvmTypesBuilder.setDocumentation(it_1, this._jvmTypesBuilder.getDocumentation(f));
                        EList<JvmFormalParameter> _params = ((Operation) f).getParams();
                        for (final JvmFormalParameter p : _params) {
                            EList<JvmFormalParameter> _parameters = it_1.getParameters();
                            JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(p, p.getName(), p.getParameterType());
                            this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
                        }
                        this._jvmTypesBuilder.setBody(it_1, ((Operation) f).getBody());
                    };
                    JvmOperation _method = this._jvmTypesBuilder.toMethod(f, _name, _elvis, _function_3);
                    this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, _method);
                }
            }
        }
        EList<JvmMember> _members_2 = it.getMembers();
        JvmOperation _toStringMethod = this._jvmTypesBuilder.toToStringMethod(entity, it);
        this._jvmTypesBuilder.<JvmOperation>operator_add(_members_2, _toStringMethod);
    };
    acceptor.<JvmGenericType>accept(this._jvmTypesBuilder.toClass(entity, this._iQualifiedNameProvider.getFullyQualifiedName(entity)), _function);
}
Also used : StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) JvmOperation(org.eclipse.xtext.common.types.JvmOperation) Operation(org.eclipse.xtext.example.domainmodel.domainmodel.Operation) Feature(org.eclipse.xtext.example.domainmodel.domainmodel.Feature) JvmOperation(org.eclipse.xtext.common.types.JvmOperation) EList(org.eclipse.emf.common.util.EList) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) JvmConstructor(org.eclipse.xtext.common.types.JvmConstructor) JvmField(org.eclipse.xtext.common.types.JvmField) JvmParameterizedTypeReference(org.eclipse.xtext.common.types.JvmParameterizedTypeReference) Property(org.eclipse.xtext.example.domainmodel.domainmodel.Property)

Example 3 with Operation

use of org.eclipse.xtext.example.domainmodel.domainmodel.Operation in project xtext-eclipse by eclipse.

the class DomainmodelCodeMiningProvider method createCodeMinings.

@Override
protected void createCodeMinings(IDocument document, XtextResource resource, CancelIndicator indicator, IAcceptor<? super ICodeMining> acceptor) throws BadLocationException {
    // get all operations to open document
    List<Operation> allOperations = EcoreUtil2.eAllOfType(resource.getContents().get(0), Operation.class);
    // get keyword for ')'
    Keyword rightParenthesisKeyword_4 = grammar.getOperationAccess().getRightParenthesisKeyword_4();
    for (Operation o : allOperations) {
        // inline annotations only for methods with no return type
        if (o.getType() != null) {
            continue;
        }
        // get return type name from operation
        JvmOperation inferredOp = (JvmOperation) jvmModelAssociations.getPrimaryJvmElement(o);
        if (inferredOp == null || inferredOp.getReturnType() == null) {
            // broken model
            continue;
        }
        String returnTypeName = inferredOp.getReturnType().getSimpleName();
        // find document offset for inline annotation
        ICompositeNode node = NodeModelUtils.findActualNodeFor(o);
        for (Iterator<INode> it = node.getAsTreeIterable().iterator(); it.hasNext(); ) {
            INode child = it.next();
            if (rightParenthesisKeyword_4.equals(child.getGrammarElement())) {
                // create line content code mining for inline annotation after grammarElement ')'
                String annotationText = " : " + returnTypeName;
                acceptor.accept(createNewLineContentCodeMining(child.getTotalOffset() + 1, annotationText));
            }
        }
    }
}
Also used : JvmOperation(org.eclipse.xtext.common.types.JvmOperation) INode(org.eclipse.xtext.nodemodel.INode) Keyword(org.eclipse.xtext.Keyword) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) JvmOperation(org.eclipse.xtext.common.types.JvmOperation) Operation(org.eclipse.xtext.example.domainmodel.domainmodel.Operation)

Example 4 with Operation

use of org.eclipse.xtext.example.domainmodel.domainmodel.Operation in project xtext-eclipse by eclipse.

the class DomainmodelLinkingDiagnosticMessageProvider method getUnresolvedProxyMessage.

@Override
public DiagnosticMessage getUnresolvedProxyMessage(final ILinkingDiagnosticContext context) {
    EObject element = context.getContext();
    if (element instanceof JvmTypeReference) {
        JvmTypeReference jvmTypeReference = (JvmTypeReference) element;
        DiagnosticMessage diagnosticMessage = new DomainmodelSwitch<DiagnosticMessage>() {

            @Override
            public DiagnosticMessage caseEntity(Entity entity) {
                return new DiagnosticMessage("Missing supertype " + context.getLinkText(), Severity.ERROR, IssueCodes.MISSING_TYPE, context.getLinkText());
            }

            @Override
            public DiagnosticMessage caseProperty(Property property) {
                return new DiagnosticMessage("Missing property type " + context.getLinkText(), Severity.ERROR, IssueCodes.MISSING_TYPE, context.getLinkText());
            }

            @Override
            public DiagnosticMessage caseOperation(Operation operation) {
                return new DiagnosticMessage("Missing return type " + context.getLinkText(), Severity.ERROR, IssueCodes.MISSING_TYPE, context.getLinkText());
            }
        }.doSwitch(jvmTypeReference.eContainer());
        if (diagnosticMessage != null)
            return diagnosticMessage;
    }
    return super.getUnresolvedProxyMessage(context);
}
Also used : Entity(org.eclipse.xtext.example.domainmodel.domainmodel.Entity) DiagnosticMessage(org.eclipse.xtext.diagnostics.DiagnosticMessage) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) EObject(org.eclipse.emf.ecore.EObject) Operation(org.eclipse.xtext.example.domainmodel.domainmodel.Operation) Property(org.eclipse.xtext.example.domainmodel.domainmodel.Property)

Example 5 with Operation

use of org.eclipse.xtext.example.domainmodel.domainmodel.Operation 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

Operation (org.eclipse.xtext.example.domainmodel.domainmodel.Operation)5 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)3 Entity (org.eclipse.xtext.example.domainmodel.domainmodel.Entity)3 Property (org.eclipse.xtext.example.domainmodel.domainmodel.Property)3 EObject (org.eclipse.emf.ecore.EObject)2 JvmFormalParameter (org.eclipse.xtext.common.types.JvmFormalParameter)2 JvmParameterizedTypeReference (org.eclipse.xtext.common.types.JvmParameterizedTypeReference)2 JvmTypeReference (org.eclipse.xtext.common.types.JvmTypeReference)2 DomainModel (org.eclipse.xtext.example.domainmodel.domainmodel.DomainModel)2 Feature (org.eclipse.xtext.example.domainmodel.domainmodel.Feature)2 PackageDeclaration (org.eclipse.xtext.example.domainmodel.domainmodel.PackageDeclaration)2 EList (org.eclipse.emf.common.util.EList)1 EPackage (org.eclipse.emf.ecore.EPackage)1 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)1 Action (org.eclipse.xtext.Action)1 Keyword (org.eclipse.xtext.Keyword)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 JvmConstructor (org.eclipse.xtext.common.types.JvmConstructor)1