/** Compute the type of an assert expression. * * @param object the expression. * @param state the state of the type resolver. */ protected void _computeTypes(SarlAssertExpression object, ITypeComputationState state) { state.withExpectation(getTypeForName(Boolean.class, state)).computeTypes(object.getCondition()); }
final XExpression condition = expression.getCondition(); if (condition != null) { final LightweightTypeReference fromType = getActualType(condition);
/** Generate the given object. * * @param assertStatement the assert statement. * @param it the target for the generated content. * @param context the context. * @return the statement. */ protected XExpression _generate(SarlAssertExpression assertStatement, IAppendable it, IExtraLanguageGeneratorContext context) { final boolean haveAssert = !assertStatement.isIsStatic() && assertStatement.getCondition() != null; if (haveAssert) { it.append("assert (lambda:"); //$NON-NLS-1$ it.increaseIndentation().newLine(); generate(assertStatement.getCondition(), it, context); it.decreaseIndentation().newLine(); it.append(")()"); //$NON-NLS-1$ } if (context.getExpectedExpressionType() != null) { if (haveAssert) { it.newLine(); } it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$ } return assertStatement; }
if (!assertExpression.isIsStatic() && assertExpression.getCondition() != null && isAtLeastJava8(assertExpression)) { final XExpression condition = assertExpression.getCondition(); final LightweightTypeReference actualType = getLightweightType(condition); if (actualType != null) {