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.
775751
protected Boolean _hasSideEffects(XUnaryOperation expression, ISideEffectContext context) {
		if (expression.isTypeLiteral() || expression.isPackageFragment()) {
			return Boolean.FALSE;
		}
		if (hasSideEffects(expression.getOperand(), context)) {
			return true;
		}
		return false;
	}
1249348
protected Boolean _hasSideEffects(XIfExpression expression, ISideEffectContext context) {
		if (hasSideEffects(expression.getIf(), context)) {
			return true;
		}
		final Map<String, List<XExpression>> buffer1 = context.createVariableAssignmentBufferForBranch();
		if (hasSideEffects(expression.getThen(), context.branch(buffer1))) {
			return true;
		}
		final Map<String, List<XExpression>> buffer2 = context.createVariableAssignmentBufferForBranch();
		if (hasSideEffects(expression.getElse(), context.branch(buffer2))) {
			return true;
		}
		context.mergeBranchVariableAssignments(Arrays.asList(buffer1, buffer2));
		return false;
	}
1169037
protected Boolean _hasSideEffects(XForLoopExpression expression, ISideEffectContext context) {
		context.open();
		if (hasSideEffects(expression.getForExpression(), context)) {
			return true;
		}
		context.close();
		return hasSideEffects(expression.getEachExpression(), context.branch());
	}
1195740
public static Expression contains(Expression expression, String substring) {
        return x("CONTAINS(" + expression.toString() + ", \"" + substring + "\")");
    }
1220114
private List<Object> eval(Iterable<ExpressionContext> expressions) {

    List<Object> results = new ArrayList<Object>();

    for (ExpressionContext expression : expressions) {
      results.add(eval(expression));
    }

    return results;
  }
1250882
public static boolean isVariable(ASTNode expression, String pattern) {
        return (expression instanceof VariableExpression && ((VariableExpression) expression).getName().matches(pattern));
    }
135888
protected Boolean _hasSideEffects(XReturnExpression expression, ISideEffectContext context) {
		return hasSideEffects(expression.getExpression(), context);
	}
851111
@Check
	public void checkBreakKeywordUse(SarlBreakExpression expression) {
		final EObject container = Utils.getFirstContainerForPredicate(expression,
				it -> !(it instanceof XExpression) || it instanceof XAbstractWhileExpression
				|| it instanceof XBasicForLoopExpression || it instanceof XForLoopExpression);
		if (container instanceof XExpression) {
			if (!isIgnored(DISCOURAGED_LOOP_BREAKING_KEYWORD_USE)
					&& container instanceof XBasicForLoopExpression) {
				addIssue(
						MessageFormat.format(Messages.SARLValidator_17, this.grammarAccess.getBreakKeyword()),
						expression,
						null,
						ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
						DISCOURAGED_LOOP_BREAKING_KEYWORD_USE);
			}
		} else {
			error(MessageFormat.format(Messages.SARLValidator_18, this.grammarAccess.getBreakKeyword()),
					expression,
					null,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
					INVALID_USE_OF_LOOP_BREAKING_KEYWORD);
		}
	}
380153
protected Boolean _hasSideEffects(XCollectionLiteral expression, ISideEffectContext context) {
		context.open();
		for (final XExpression ex : expression.getElements()) {
			if (hasSideEffects(ex, context)) {
				return true;
			}
		}
		context.close();
		return false;
	}
172454
public static boolean isConstantOrConstantLiteral(Expression expression) {
        return expression instanceof ConstantExpression ||
            isPredefinedConstant(expression) ||
            isMapLiteralWithOnlyConstantValues(expression) ||
            isListLiteralWithOnlyConstantValues(expression);
    }
1372054
@Override
  public void setFilter(@NonNull Expression expression) {
    layerFilter = expression;
    layer.setFilter(layerFilter);
  }
548013
public static boolean isConstructorCall(Expression expression, List<String> classNames) {
        return expression instanceof ConstructorCallExpression && classNames.contains(expression.getType().getName());
    }
1048393
protected Boolean _hasSideEffects(XMemberFeatureCall expression, ISideEffectContext context) {
		return internalHasOperationSideEffects(expression, context, false);
	}
1228470
private boolean passesExpression(LoggingEvent event) {
    if (event != null) {
      if (expressionRule != null) {
        return (expressionRule.evaluate(event, null));
      }
    }
    return true;
  }
696477
public static boolean isSafe(Expression expression) {
        if (expression instanceof MethodCallExpression) {
            return ((MethodCallExpression) expression).isSafe();
        }
        if (expression instanceof PropertyExpression) {
            return ((PropertyExpression) expression).isSafe();
        }
        return false;
    }
325669
protected static boolean isNestable(String expression) {
        return !(expression.contains(SearchExpressionConstants.ALL_KEYWORD)
                || expression.contains(SearchExpressionConstants.NONE_KEYWORD)
                || expression.contains(SearchExpressionConstants.PFS_PREFIX));
    }
858346
private Statement getSideEffects(Expression expr) {
    Expression sideEffectsExpr = extractSideEffects(expr);
    return sideEffectsExpr == null ? null : new ExpressionStatement(sideEffectsExpr);
  }