Search in sources :

Example 1 with Boolean_Type

use of org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type in project titan.EclipsePlug-ins by eclipse.

the class For_Statement method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    if (definitions != null) {
        definitions.check(timestamp);
    }
    if (initialAssignment != null) {
        initialAssignment.check(timestamp);
    }
    if (finalExpression != null) {
        finalExpression.setLoweridToReference(timestamp);
        final IValue lastValue = finalExpression.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
        final Type_type temp = lastValue.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
        switch(temp) {
            case TYPE_BOOL:
                if (!lastValue.isUnfoldable(timestamp)) {
                    if (((Boolean_Value) lastValue).getValue()) {
                        finalExpression.getLocation().reportConfigurableSemanticProblem(Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.REPORTUNNECESSARYCONTROLS, GeneralConstants.WARNING, null), UNNECESSARYCONTROL);
                    } else {
                        finalExpression.getLocation().reportConfigurableSemanticProblem(Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.REPORTUNNECESSARYCONTROLS, GeneralConstants.WARNING, null), NEVERREACH);
                    }
                }
                break;
            default:
                location.reportSemanticError(OPERANDERROR);
                finalExpression.setIsErroneous(true);
                break;
        }
        if (finalExpression.getMyGovernor() == null) {
            finalExpression.setMyGovernor(new Boolean_Type());
        }
    }
    if (stepAssignment != null) {
        stepAssignment.check(timestamp);
    }
    if (statementblock != null) {
        statementblock.setMyLaicStmt(null, this);
        statementblock.check(timestamp);
    // warning for "return" has been removed. Not valid problem
    }
    lastTimeChecked = timestamp;
}
Also used : Boolean_Value(org.eclipse.titan.designer.AST.TTCN3.values.Boolean_Value) IValue(org.eclipse.titan.designer.AST.IValue) Boolean_Type(org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type) Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Example 2 with Boolean_Type

use of org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type in project titan.EclipsePlug-ins by eclipse.

the class FieldSetting_Type method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp, final FieldSpecification fieldSpecification) {
    if (null != lastTimeChecked && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    if (!Fieldspecification_types.FS_T.equals(fieldSpecification.getFieldSpecificationType())) {
        location.reportSemanticError(TYPESETTINGEXPECTED);
        type = new Boolean_Type();
        type.setIsErroneous(true);
        type.setFullNameParent(this);
    }
    lastTimeChecked = timestamp;
    type.check(timestamp);
    final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    type.checkRecursions(timestamp, referenceChain);
    referenceChain.release();
}
Also used : Boolean_Type(org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain)

Example 3 with Boolean_Type

use of org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type in project titan.EclipsePlug-ins by eclipse.

the class Referenced_Altguard method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    if (expression != null) {
        final IValue last = expression.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
        final Type_type temporalType = last.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
        if (!last.getIsErroneous(timestamp) && !Type_type.TYPE_BOOL.equals(temporalType)) {
            last.getLocation().reportSemanticError(BOOLEANEXPECTED);
            expression.setIsErroneous(true);
        }
        if (expression.getMyGovernor() == null) {
            expression.setMyGovernor(new Boolean_Type());
        }
    }
    if (reference != null) {
        final Assignment assignment = reference.getRefdAssignment(timestamp, true);
        if (assignment != null) {
            if (Assignment_type.A_ALTSTEP.semanticallyEquals(assignment.getAssignmentType())) {
                reference.getMyScope().checkRunsOnScope(timestamp, assignment, reference, "call");
            } else {
                reference.getLocation().reportSemanticError(MessageFormat.format(ALTSTEPREFERENCEEXPECTED, assignment.getAssignmentName()));
            }
        }
    }
    if (statementblock != null) {
        statementblock.check(timestamp);
    }
    lastTimeChecked = timestamp;
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) IValue(org.eclipse.titan.designer.AST.IValue) Boolean_Type(org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type) Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Example 4 with Boolean_Type

use of org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type in project titan.EclipsePlug-ins by eclipse.

the class Operation_Altguard method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    if (expression != null) {
        final IValue last = expression.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
        final Type_type temporalType = last.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
        if (!last.getIsErroneous(timestamp) && !Type_type.TYPE_BOOL.equals(temporalType)) {
            last.getLocation().reportSemanticError(BOOLEANEXPECTED);
            expression.setIsErroneous(true);
        }
        if (expression.getMyGovernor() == null) {
            expression.setMyGovernor(new Boolean_Type());
        }
    }
    if (statement != null) {
        statement.check(timestamp);
    }
    if (statementblock != null) {
        statementblock.check(timestamp);
    }
    lastTimeChecked = timestamp;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Boolean_Type(org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type) Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Example 5 with Boolean_Type

use of org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type in project titan.EclipsePlug-ins by eclipse.

the class While_Statement method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    isInfiniteLoop = false;
    if (expression != null) {
        final IValue last = expression.getValueRefdLast(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE, null);
        final Type_type temporalType = last.getExpressionReturntype(timestamp, Expected_Value_type.EXPECTED_DYNAMIC_VALUE);
        if (!last.getIsErroneous(timestamp)) {
            if (!Type_type.TYPE_BOOL.equals(temporalType)) {
                last.getLocation().reportSemanticError(BOOLEANEXPECTED);
                expression.setIsErroneous(true);
            } else if (!expression.isUnfoldable(timestamp)) {
                if (!((Boolean_Value) last).getValue()) {
                    expression.getLocation().reportConfigurableSemanticProblem(Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.REPORTUNNECESSARYCONTROLS, GeneralConstants.WARNING, null), NEVERREACH);
                } else if (ReturnStatus_type.RS_NO.equals(hasReturn(timestamp))) {
                    isInfiniteLoop = true;
                    location.reportConfigurableSemanticProblem(Platform.getPreferencesService().getString(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.REPORTINFINITELOOPS, GeneralConstants.WARNING, null), INFINITELOOP);
                }
            }
            if (expression.getMyGovernor() == null) {
                expression.setMyGovernor(new Boolean_Type());
            }
        }
    }
    if (statementblock != null) {
        statementblock.setMyLaicStmt(null, this);
        statementblock.check(timestamp);
    }
    lastTimeChecked = timestamp;
}
Also used : Boolean_Value(org.eclipse.titan.designer.AST.TTCN3.values.Boolean_Value) IValue(org.eclipse.titan.designer.AST.IValue) Boolean_Type(org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type) Type_type(org.eclipse.titan.designer.AST.IType.Type_type)

Aggregations

Boolean_Type (org.eclipse.titan.designer.AST.TTCN3.types.Boolean_Type)8 Type_type (org.eclipse.titan.designer.AST.IType.Type_type)7 IValue (org.eclipse.titan.designer.AST.IValue)7 Boolean_Value (org.eclipse.titan.designer.AST.TTCN3.values.Boolean_Value)3 Assignment (org.eclipse.titan.designer.AST.Assignment)1 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)1 IType (org.eclipse.titan.designer.AST.IType)1 ActualParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)1 FormalParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList)1 Altstep_Type (org.eclipse.titan.designer.AST.TTCN3.types.Altstep_Type)1