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(); }
protected Object _internalEvaluate(final XBinaryOperation it, final Context ctx) { Object _xblockexpression = null; { final Context context = ctx.cloneWithExpectation(null); final Object left = this.evaluate(it.getLeftOperand(), context); final Object right = this.evaluate(it.getRightOperand(), context); _xblockexpression = this.evaluateBinaryOperation(it, left, right); } return _xblockexpression; }
protected Object _doEvaluate(XSetLiteral literal, IEvaluationContext context, CancelIndicator indicator) { if(isType(literal, Map.class)) { Map<Object, Object> map = newHashMap(); for(XExpression element: literal.getElements()) { if (indicator.isCanceled()) throw new InterpreterCanceledException(); if (expressionHelper.isOperatorFromExtension(element, OperatorMapping.MAPPED_TO, ObjectExtensions.class)) { map.put(internalEvaluate(((XBinaryOperation)element).getLeftOperand(), context, indicator), internalEvaluate(((XBinaryOperation)element).getRightOperand(), context, indicator)); } else if (isType(element, Pair.class)) { Pair<?, ?> pair = (Pair<?, ?>) internalEvaluate(element, context, indicator); map.put(pair == null ? null : pair.getKey(), pair == null ? null : pair.getValue()); } } return Collections.unmodifiableMap(map); } else { Set<Object> set = newHashSet(); for(XExpression element: literal.getElements()) { if (indicator.isCanceled()) throw new InterpreterCanceledException(); set.add(internalEvaluate(element, context, indicator)); } return Collections.unmodifiableSet(set); } }
/** Test if the given expression has side effects. * * @param expression the expression. * @param context the list of context expressions. * @return {@code true} if the expression has side effects. */ protected Boolean _hasSideEffects(XBinaryOperation expression, ISideEffectContext context) { if (isReassignmentOperator(expression)) { if (!isLocalExpression(expression.getLeftOperand(), context, false)) { return true; } } else { if (expression.isTypeLiteral() || expression.isPackageFragment()) { return false; } if (hasSideEffects(expression.getLeftOperand(), context)) { return true; } } if (hasSideEffects(expression.getRightOperand(), context)) { return true; } return false; }
Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _prepend = this._formattingDataFactory.prepend(op, _function); format.operator_add(_prepend); if ((this.isMultiline(call.getRightOperand(), format) || this.fitsIntoLine(format, call.getRightOperand()))) { final Procedure1<FormattingDataInit> _function_1 = (FormattingDataInit it) -> { it.oneSpace(); this.format(call.getRightOperand(), format);
throw new IllegalArgumentException(MessageFormat.format(Messages.PyExpressionGenerator_0, operator)); generate(operation.getRightOperand(), it, context); it.append(")"); //$NON-NLS-1$
@Check public void checkOperandTypesForTripleEquals(XBinaryOperation binaryOperation) { if(isTripleEqualsOperation(binaryOperation)){ LightweightTypeReference left = getActualType(binaryOperation.getLeftOperand()); LightweightTypeReference right = getActualType(binaryOperation.getRightOperand()); if(left.isArray() != right.isArray()) { if (left.isArray()) { if (right.isAny() || right.isType(Object.class) || right.isType(Serializable.class) || right.isType(Cloneable.class)) { return; } } else { if (left.isAny() || left.isType(Object.class) || left.isType(Serializable.class) || left.isType(Cloneable.class)) { return; } } error("Incompatible operand types " + left.getHumanReadableName() + " and " + right.getHumanReadableName(), null, INVALID_OPERAND_TYPES); } } }
acceptor.accept(opAdd.getXBinaryOperationLeftOperandAction_1_0_0_0(), operation.getLeftOperand()); acceptor.accept(opAdd.getFeatureJvmIdentifiableElementOpAddParserRuleCall_1_0_0_1_0_1(), operation.getFeature(), featureToken, featureNode); acceptor.accept(opAdd.getRightOperandXMultiplicativeExpressionParserRuleCall_1_1_0(), operation.getRightOperand()); } else if((featureToken = getValidOperator(operation, opMulti.getFeatureJvmIdentifiableElementOpMultiParserRuleCall_1_0_0_1_0_1(), operatorNames, featureNode)) != null) { acceptor.accept(opMulti.getXBinaryOperationLeftOperandAction_1_0_0_0(), operation.getLeftOperand()); acceptor.accept(opMulti.getFeatureJvmIdentifiableElementOpMultiParserRuleCall_1_0_0_1_0_1(), operation.getFeature(), featureToken, featureNode); acceptor.accept(opMulti.getRightOperandXUnaryOperationParserRuleCall_1_1_0(), operation.getRightOperand()); } else if((featureToken = getValidOperator(operation, opOther.getFeatureJvmIdentifiableElementOpOtherParserRuleCall_1_0_0_1_0_1(), operatorNames, featureNode)) != null) { acceptor.accept(opOther.getXBinaryOperationLeftOperandAction_1_0_0_0(), operation.getLeftOperand()); acceptor.accept(opOther.getFeatureJvmIdentifiableElementOpOtherParserRuleCall_1_0_0_1_0_1(), operation.getFeature(), featureToken, featureNode); acceptor.accept(opOther.getRightOperandXAdditiveExpressionParserRuleCall_1_1_0(), operation.getRightOperand()); } else if((featureToken = getValidOperator(operation, opCompare.getFeatureJvmIdentifiableElementOpCompareParserRuleCall_1_1_0_0_1_0_1(), operatorNames, featureNode)) != null) { acceptor.accept(opCompare.getXBinaryOperationLeftOperandAction_1_1_0_0_0(), operation.getLeftOperand()); acceptor.accept(opCompare.getFeatureJvmIdentifiableElementOpCompareParserRuleCall_1_1_0_0_1_0_1(), operation.getFeature(), featureToken, featureNode); acceptor.accept(opCompare.getRightOperandXOtherOperatorExpressionParserRuleCall_1_1_1_0(), operation.getRightOperand()); } else if((featureToken = getValidOperator(operation, opEquality.getFeatureJvmIdentifiableElementOpEqualityParserRuleCall_1_0_0_1_0_1(), operatorNames, featureNode)) != null) { acceptor.accept(opEquality.getXBinaryOperationLeftOperandAction_1_0_0_0(), operation.getLeftOperand()); acceptor.accept(opEquality.getFeatureJvmIdentifiableElementOpEqualityParserRuleCall_1_0_0_1_0_1(), operation.getFeature(), featureToken, featureNode); acceptor.accept(opEquality.getRightOperandXRelationalExpressionParserRuleCall_1_1_0(), operation.getRightOperand()); } else if((featureToken = getValidOperator(operation, opAnd.getFeatureJvmIdentifiableElementOpAndParserRuleCall_1_0_0_1_0_1(), operatorNames, featureNode)) != null) { acceptor.accept(opAnd.getXBinaryOperationLeftOperandAction_1_0_0_0(), operation.getLeftOperand()); acceptor.accept(opAnd.getFeatureJvmIdentifiableElementOpAndParserRuleCall_1_0_0_1_0_1(), operation.getFeature(), featureToken, featureNode); acceptor.accept(opAnd.getRightOperandXEqualityExpressionParserRuleCall_1_1_0(), operation.getRightOperand()); } else if((featureToken = getValidOperator(operation, opOr.getFeatureJvmIdentifiableElementOpOrParserRuleCall_1_0_0_1_0_1(), operatorNames, featureNode)) != null) { acceptor.accept(opOr.getXBinaryOperationLeftOperandAction_1_0_0_0(), operation.getLeftOperand()); acceptor.accept(opOr.getFeatureJvmIdentifiableElementOpOrParserRuleCall_1_0_0_1_0_1(), operation.getFeature(), featureToken, featureNode); acceptor.accept(opOr.getRightOperandXAndExpressionParserRuleCall_1_1_0(), operation.getRightOperand()); } else if((featureToken = getValidOperator(operation, opMultiAssign.getFeatureJvmIdentifiableElementOpMultiAssignParserRuleCall_1_1_0_0_1_0_1(), operatorNames, featureNode)) != null) { acceptor.accept(opMultiAssign.getXBinaryOperationLeftOperandAction_1_1_0_0_0(), operation.getLeftOperand());
protected void generateShortCircuitInvocation(final XAbstractFeatureCall featureCall, final ITreeAppendable b) { final XBinaryOperation binaryOperation = (XBinaryOperation) featureCall; final XExpression leftOperand = binaryOperation.getLeftOperand(); final XExpression rightOperand = binaryOperation.getRightOperand(); declareSyntheticVariable(binaryOperation, b); boolean isElvis = binaryOperation.getConcreteSyntaxFeatureName().equals(expressionHelper.getElvisOperator());
protected EvaluationResult _internalEvaluate(final XBinaryOperation it, final EvaluationContext context) { if ((this.isFromXbaseLibrary(it, context) && (it.getRightOperand() != null))) { final EvaluationResult left = this.doEvaluate(it.getLeftOperand(), context); final EvaluationResult right = this.doEvaluate(it.getRightOperand(), context); try { final String op = it.getConcreteSyntaxFeatureName();
}; format.prepend(sep, _function_2); format.<XExpression>format(ele.getObject().getRightOperand());
final XBinaryOperation binaryOperation = (XBinaryOperation) expr; final XExpression leftOperand = binaryOperation.getLeftOperand(); final XExpression rightOperand = binaryOperation.getRightOperand();
String operatorSymbol = binaryOperation.getConcreteSyntaxFeatureName(); XExpression left = binaryOperation.getLeftOperand(); XExpression right = binaryOperation.getRightOperand(); if (right != null && right.eClass() == XbasePackage.Literals.XNULL_LITERAL || left != null && left.eClass() == XbasePackage.Literals.XNULL_LITERAL) { boolean equalsComparison = expressionHelper.isOperatorFromExtension(binaryOperation, operatorSymbol, OperatorMapping.EQUALS, ObjectExtensions.class)