public XExpression getSyntacticReceiver(XExpression expression) { if (expression instanceof XAbstractFeatureCall) { if (expression instanceof XFeatureCall) { return null; } if (expression instanceof XMemberFeatureCall) { return ((XMemberFeatureCall) expression).getMemberCallTarget(); } if (expression instanceof XAssignment) { return ((XAssignment) expression).getAssignable(); } if (expression instanceof XBinaryOperation) { return ((XBinaryOperation) expression).getLeftOperand(); } if (expression instanceof XUnaryOperation) { return ((XUnaryOperation) expression).getOperand(); } if (expression instanceof XPostfixOperation) { return ((XPostfixOperation) expression).getOperand(); } } return null; }
public List<XExpression> getSyntacticArguments(XAbstractFeatureCall expression) { if (expression instanceof XFeatureCall) { return ((XFeatureCall) expression).getFeatureCallArguments(); } if (expression instanceof XMemberFeatureCall) { return ((XMemberFeatureCall) expression).getMemberCallArguments(); } if (expression instanceof XAssignment) { return Collections.singletonList(((XAssignment) expression).getValue()); } if (expression instanceof XBinaryOperation) { return Collections.singletonList(((XBinaryOperation) expression).getRightOperand()); } // explicit condition to make sure we thought about it if (expression instanceof XUnaryOperation) { return Collections.emptyList(); } if (expression instanceof XPostfixOperation) { return Collections.emptyList(); } return Collections.emptyList(); }
@Check public void checkAssignment(XPostfixOperation postfixOperation) { if (expressionHelper.isGetAndAssign(postfixOperation)) { XExpression firstArgument = postfixOperation.getActualArguments().get(0); checkAssignment(firstArgument, false); } }
@Override protected String getSyntaxDescriptions() { XExpression expression = getExpression(); if (expression instanceof XBinaryOperation) { return "binary operation"; } else if (expression instanceof XUnaryOperation) { return "unary operation"; } else if (expression instanceof XPostfixOperation) { return "postfix operation"; } else { return "feature call"; } }
protected boolean startsWithUnaryOperator(EObject obj) { if(obj instanceof XUnaryOperation) return true; if(obj instanceof XBinaryOperation) return startsWithUnaryOperator(((XBinaryOperation)obj).getLeftOperand()); if(obj instanceof XPostfixOperation) { return startsWithUnaryOperator(((XPostfixOperation)obj).getOperand()); } return false; }
protected void _format(final XPostfixOperation expr, @Extension final IFormattableDocument doc) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.noSpace(); }; doc.prepend(this.textRegionExtensions.regionFor(expr).feature(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE), _function); doc.<XExpression>format(expr.getOperand()); }
@Deprecated protected void sequence_XPostfixOperation(EObject context, XPostfixOperation semanticObject) { sequence_XPostfixOperation(createContext(context, semanticObject), semanticObject); }
public boolean isGetAndAssign(XAbstractFeatureCall featureCall) { if (!(featureCall instanceof XPostfixOperation)) { return false; } if (isOperatorFromExtension(featureCall, OperatorMapping.MINUS_MINUS, DoubleExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.PLUS_PLUS, DoubleExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.MINUS_MINUS, FloatExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.PLUS_PLUS, FloatExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.MINUS_MINUS, LongExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.PLUS_PLUS, LongExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.MINUS_MINUS, IntegerExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.PLUS_PLUS, IntegerExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.MINUS_MINUS, ShortExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.PLUS_PLUS, ShortExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.MINUS_MINUS, CharacterExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.PLUS_PLUS, CharacterExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.MINUS_MINUS, ByteExtensions.class)) { return true; } if (isOperatorFromExtension(featureCall, OperatorMapping.PLUS_PLUS, ByteExtensions.class)) { return true; } return false; }
/** * Contexts: * XExpression returns XPostfixOperation * XAssignment returns XPostfixOperation * XAssignment.XBinaryOperation_1_1_0_0_0 returns XPostfixOperation * XOrExpression returns XPostfixOperation * XOrExpression.XBinaryOperation_1_0_0_0 returns XPostfixOperation * XAndExpression returns XPostfixOperation * XAndExpression.XBinaryOperation_1_0_0_0 returns XPostfixOperation * XEqualityExpression returns XPostfixOperation * XEqualityExpression.XBinaryOperation_1_0_0_0 returns XPostfixOperation * XRelationalExpression returns XPostfixOperation * XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XPostfixOperation * XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XPostfixOperation * XOtherOperatorExpression returns XPostfixOperation * XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XPostfixOperation * XAdditiveExpression returns XPostfixOperation * XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XPostfixOperation * XMultiplicativeExpression returns XPostfixOperation * XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XPostfixOperation * XUnaryOperation returns XPostfixOperation * XCastedExpression returns XPostfixOperation * XCastedExpression.XCastedExpression_1_0_0_0 returns XPostfixOperation * XPostfixOperation returns XPostfixOperation * XPostfixOperation.XPostfixOperation_1_0_0 returns XPostfixOperation * XMemberFeatureCall returns XPostfixOperation * XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XPostfixOperation * XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XPostfixOperation * XPrimaryExpression returns XPostfixOperation * XParenthesizedExpression returns XPostfixOperation * XExpressionOrVarDeclaration returns XPostfixOperation * * Constraint: * (operand=XPostfixOperation_XPostfixOperation_1_0_0 feature=[JvmIdentifiableElement|OpPostfix]) */ protected void sequence_XPostfixOperation(ISerializationContext context, XPostfixOperation semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XPOSTFIX_OPERATION__OPERAND) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XPOSTFIX_OPERATION__OPERAND)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXPostfixOperationAccess().getXPostfixOperationOperandAction_1_0_0(), semanticObject.getOperand()); feeder.accept(grammarAccess.getXPostfixOperationAccess().getFeatureJvmIdentifiableElementOpPostfixParserRuleCall_1_0_1_0_1(), semanticObject.eGet(XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, false)); feeder.finish(); }
/** * Constraint: * (operand=XPostfixOperation_XPostfixOperation_1_0_0 feature=[JvmIdentifiableElement|OpPostfix]) */ protected void sequence_XPostfixOperation(EObject context, XPostfixOperation semanticObject) { genericSequencer.createSequence(context, semanticObject); }