Search in sources :

Example 21 with Referenced_Value

use of org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value in project titan.EclipsePlug-ins by eclipse.

the class Unknown_Stop_Statement method check.

@Override
public /**
 * {@inheritDoc}
 */
void check(final CompilationTimeStamp timestamp) {
    if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
        return;
    }
    lastTimeChecked = timestamp;
    final Assignment assignment = reference.getRefdAssignment(timestamp, true);
    if (assignment == null) {
        return;
    }
    switch(assignment.getAssignmentType()) {
        case A_PORT:
        case A_PAR_PORT:
            if (realStatement == null || !Statement_type.S_STOP_PORT.equals(realStatement.getType())) {
                realStatement = new Stop_Port_Statement(reference);
                realStatement.setFullNameParent(this);
                realStatement.setLocation(location);
                realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
            }
            realStatement.check(timestamp);
            break;
        case A_TIMER:
        case A_PAR_TIMER:
            if (realStatement == null || !Statement_type.S_STOP_TIMER.equals(realStatement.getType())) {
                realStatement = new Stop_Timer_Statement(reference);
                realStatement.setFullNameParent(this);
                realStatement.setLocation(location);
                realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
            }
            realStatement.check(timestamp);
            break;
        case A_CONST:
        case A_EXT_CONST:
        case A_MODULEPAR:
        case A_VAR:
        case A_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RVAL:
        case A_PAR_VAL:
        case A_PAR_VAL_IN:
        case A_PAR_VAL_OUT:
        case A_PAR_VAL_INOUT:
            if (realStatement == null || !Statement_type.S_STOP_COMPONENT.equals(realStatement.getType())) {
                realStatement = new Stop_Component_Statement(new Referenced_Value(reference));
                realStatement.setMyScope(reference.getMyScope());
                realStatement.setFullNameParent(this);
                realStatement.setLocation(location);
                realStatement.setMyStatementBlock(getMyStatementBlock(), statementIndex);
            }
            realStatement.check(timestamp);
            break;
        default:
            reference.getLocation().reportSemanticError(MessageFormat.format(UNEXPECTEDREFERENCE, assignment.getDescription()));
            break;
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) Referenced_Value(org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value)

Example 22 with Referenced_Value

use of org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value in project titan.EclipsePlug-ins by eclipse.

the class Anytype_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    if (getIsErroneous(timestamp)) {
        return false;
    }
    boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    switch(last.getValuetype()) {
        case SEQUENCE_VALUE:
            last = last.setValuetype(timestamp, Value_type.ANYTYPE_VALUE);
            if (!last.getIsErroneous(timestamp)) {
                selfReference = checkThisValueAnytype(timestamp, (Anytype_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
            }
            break;
        case ANYTYPE_VALUE:
            selfReference = checkThisValueAnytype(timestamp, (Anytype_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            value.getLocation().reportSemanticError(MessageFormat.format(ANYTYPEEXPECTED, getFullName()));
            value.setIsErroneous(true);
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Anytype_Value(org.eclipse.titan.designer.AST.TTCN3.values.Anytype_Value)

Example 23 with Referenced_Value

use of org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value in project titan.EclipsePlug-ins by eclipse.

the class Array_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    switch(last.getValuetype()) {
        case SEQUENCEOF_VALUE:
            last = last.setValuetype(timestamp, Value_type.ARRAY_VALUE);
            selfReference = checkThisValueArray(timestamp, value, lhs, (Array_Value) last, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            break;
        case ARRAY_VALUE:
            selfReference = checkThisValueArray(timestamp, value, lhs, (Array_Value) last, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            value.getLocation().reportSemanticError(ARRAYVALUEEXPECTED);
            value.setIsErroneous(true);
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : Array_Value(org.eclipse.titan.designer.AST.TTCN3.values.Array_Value) IValue(org.eclipse.titan.designer.AST.IValue)

Example 24 with Referenced_Value

use of org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value in project titan.EclipsePlug-ins by eclipse.

the class Signature_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    if (getIsErroneous(timestamp)) {
        return false;
    }
    boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    switch(last.getValuetype()) {
        case SEQUENCE_VALUE:
            selfReference = checkThisValueSequence(timestamp, (Sequence_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            break;
        case SEQUENCEOF_VALUE:
            last = last.setValuetype(timestamp, Value_type.SEQUENCE_VALUE);
            selfReference = checkThisValueSequence(timestamp, (Sequence_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            value.getLocation().reportSemanticError(MessageFormat.format(SIGNATUREEXPECTED, getTypename()));
            value.setIsErroneous(true);
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Sequence_Value(org.eclipse.titan.designer.AST.TTCN3.values.Sequence_Value)

Example 25 with Referenced_Value

use of org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value in project titan.EclipsePlug-ins by eclipse.

the class TTCN3_Choice_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    if (getIsErroneous(timestamp)) {
        return false;
    }
    boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    // already handled ones
    switch(value.getValuetype()) {
        case OMIT_VALUE:
        case REFERENCED_VALUE:
            return selfReference;
        case UNDEFINED_LOWERIDENTIFIER_VALUE:
            if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
                return selfReference;
            }
            break;
        default:
            break;
    }
    switch(last.getValuetype()) {
        case SEQUENCE_VALUE:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
                value.setIsErroneous(true);
            } else {
                last = last.setValuetype(timestamp, Value_type.CHOICE_VALUE);
                if (!last.getIsErroneous(timestamp)) {
                    selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
                }
            }
            break;
        case CHOICE_VALUE:
            selfReference = checkThisValueChoice(timestamp, (Choice_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.str_elem);
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(MessageFormat.format(CHOICEEXPECTED, getFullName()));
            } else {
                value.getLocation().reportSemanticError(MessageFormat.format(UNIONEXPECTED, getFullName()));
            }
            value.setIsErroneous(true);
    }
    if (valueCheckingOptions.sub_check) {
        // there is no parent type to check
        if (subType != null) {
            subType.checkThisValue(timestamp, last);
        }
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) Choice_Value(org.eclipse.titan.designer.AST.TTCN3.values.Choice_Value)

Aggregations

IValue (org.eclipse.titan.designer.AST.IValue)40 Referenced_Value (org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value)22 Assignment (org.eclipse.titan.designer.AST.Assignment)17 Reference (org.eclipse.titan.designer.AST.Reference)15 SpecificValue_Template (org.eclipse.titan.designer.AST.TTCN3.templates.SpecificValue_Template)13 IType (org.eclipse.titan.designer.AST.IType)11 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)10 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)9 ISubReference (org.eclipse.titan.designer.AST.ISubReference)7 TTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.TTCN3Template)6 Referenced_Template (org.eclipse.titan.designer.AST.TTCN3.templates.Referenced_Template)5 Boolean_Value (org.eclipse.titan.designer.AST.TTCN3.values.Boolean_Value)5 SequenceOf_Value (org.eclipse.titan.designer.AST.TTCN3.values.SequenceOf_Value)5 Identifier (org.eclipse.titan.designer.AST.Identifier)4 Expected_Value_type (org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type)4 Bitstring_Value (org.eclipse.titan.designer.AST.TTCN3.values.Bitstring_Value)4 Charstring_Value (org.eclipse.titan.designer.AST.TTCN3.values.Charstring_Value)4 Expression_Value (org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value)4 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)4 ReferenceChain (org.eclipse.titan.designer.AST.ReferenceChain)3