Search in sources :

Example 21 with Omit_Value

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

the class Function_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    final boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
    final IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
    if (last == null || last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    last.setMyGovernor(this);
    // 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;
    }
    Assignment assignment = null;
    switch(last.getValuetype()) {
        case FUNCTION_REFERENCE_VALUE:
            assignment = ((Function_Reference_Value) last).getReferredFunction();
            if (assignment == null) {
                value.setIsErroneous(true);
                return selfReference;
            }
            assignment.check(timestamp);
            break;
        case TTCN3_NULL_VALUE:
            value.setValuetype(timestamp, Value_type.FAT_NULL_VALUE);
            return selfReference;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            return selfReference;
        default:
            value.getLocation().reportSemanticError(FUNCTIONREFERENCEVALUEEXPECTED);
            value.setIsErroneous(true);
            return selfReference;
    }
    // external functions do not have runs on clauses
    if (assignment instanceof Def_Function) {
        formalParList.checkCompatibility(timestamp, ((Def_Function) assignment).getFormalParameterList(), value.getLocation());
        final IType tempRunsOnType = ((Def_Function) assignment).getRunsOnType(timestamp);
        if (tempRunsOnType != null) {
            if (runsOnSelf) {
                // check against the runs on component type of the scope of the value
                final Scope valueScope = value.getMyScope();
                if (valueScope == null) {
                    value.setIsErroneous(true);
                    value.setLastTimeChecked(timestamp);
                    return selfReference;
                }
                final RunsOnScope runsOnScope = valueScope.getScopeRunsOn();
                if (runsOnScope != null) {
                    final Component_Type componentType = runsOnScope.getComponentType();
                    if (!tempRunsOnType.isCompatible(timestamp, componentType, null, null, null)) {
                        value.getLocation().reportSemanticError(MessageFormat.format("Runs on clause mismatch: type `{0}'' has a `runs on self'' clause and the current scope expects " + "component type `{1}'', but {2} runs on `{3}''", getTypename(), componentType.getTypename(), assignment.getDescription(), tempRunsOnType.getTypename()));
                    }
                } else {
                    // compatibility using this component type as the scope
                    if (valueScope instanceof ComponentTypeBody) {
                        final ComponentTypeBody body = (ComponentTypeBody) valueScope;
                        if (!tempRunsOnType.isCompatible(timestamp, body.getMyType(), null, null, null)) {
                            value.getLocation().reportSemanticError(MessageFormat.format("Runs on clause mismatch: type `{0}'' has a `runs on self'' clause and the current component definition " + "is of type `{1}'', but {2} runs on `{3}''", getTypename(), body.getMyType().getTypename(), assignment.getDescription(), tempRunsOnType.getTypename()));
                        }
                    } else {
                        value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' has a `runs on self'' " + "clause and the current scope does not have a `runs on'' clause, but {1} runs on `{2}''", getTypename(), assignment.getDescription(), tempRunsOnType.getTypename()));
                    }
                }
            } else {
                if (runsOnRef == null) {
                    value.getLocation().reportSemanticError(MessageFormat.format(RUNSONLESSEXPECTED, getTypename(), assignment.getAssignmentName(), tempRunsOnType.getTypename()));
                    value.setIsErroneous(true);
                } else {
                    if (runsOnType != null && !tempRunsOnType.isCompatible(timestamp, runsOnType, null, null, null)) {
                        value.getLocation().reportSemanticError(MessageFormat.format(INCOMPATIBLERUNSONTYPESERROR, getTypename(), runsOnType.getTypename(), assignment.getAssignmentName(), tempRunsOnType.getTypename()));
                        value.setIsErroneous(true);
                    }
                }
            }
        }
    }
    switch(assignment.getAssignmentType()) {
        case A_FUNCTION:
        case A_EXT_FUNCTION:
            if (returnType != null) {
                value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function that returns a {1} of type `{2}'', but {3} does not have a return type", getTypename(), returnsTemplate ? "template" : "value", returnType.getTypename(), assignment.getDescription()));
            }
            break;
        case A_FUNCTION_RTEMP:
            {
                final Restriction_type restriction = ((Def_Function) assignment).getTemplateRestriction();
                if (!templateRestriction.equals(restriction)) {
                    value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function that returns a template with {1} restriction, " + "but {2} returns a template with {3} restriction", getTypename(), Restriction_type.TR_NONE.equals(templateRestriction) ? "no" : templateRestriction.getDisplayName(), assignment.getDescription(), Restriction_type.TR_NONE.equals(restriction) ? "no" : restriction.getDisplayName()));
                }
                if (returnType != null) {
                    final IType tempReturnType = assignment.getType(timestamp);
                    if (!returnType.isIdentical(timestamp, tempReturnType)) {
                        value.getLocation().reportSemanticError(MessageFormat.format("Return type mismatch: type `{0}'' expects a function or external function that returns a {1} of type `{2}'', " + "but {3} returns a template of type `{3}''", getTypename(), returnsTemplate ? "template" : "value", returnType.getTypename(), assignment.getDescription(), tempReturnType.getTypename()));
                    } else if (!returnsTemplate) {
                        value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function that returns a value of type `{1}'', but {2} returns a template", getTypename(), returnType.getTypename(), assignment.getDescription()));
                    }
                } else {
                    value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function without return type, but {1} returns a template of type `{2}''", getTypename(), assignment.getDescription(), assignment.getType(timestamp).getTypename()));
                }
                break;
            }
        case A_EXT_FUNCTION_RTEMP:
            {
                final Restriction_type restriction = ((Def_Extfunction) assignment).getTemplateRestriction();
                if (!templateRestriction.equals(restriction)) {
                    value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function that returns a template with {1} restriction, " + "but {2} returns a template with {3} restriction", getTypename(), Restriction_type.TR_NONE.equals(templateRestriction) ? "no" : templateRestriction.getDisplayName(), assignment.getDescription(), Restriction_type.TR_NONE.equals(restriction) ? "no" : restriction.getDisplayName()));
                }
                if (returnType != null) {
                    final IType tempReturnType = assignment.getType(timestamp);
                    if (!returnType.isIdentical(timestamp, tempReturnType)) {
                        value.getLocation().reportSemanticError(MessageFormat.format("Return type mismatch: type `{0}'' expects a function or external function that returns a {1} of type `{2}'', " + "but {3} returns a template of type `{3}''", getTypename(), returnsTemplate ? "template" : "value", returnType.getTypename(), assignment.getDescription(), tempReturnType.getTypename()));
                    } else if (!returnsTemplate) {
                        value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function that returns a value of type `{1}'', but {2} returns a template", getTypename(), returnType.getTypename(), assignment.getDescription()));
                    }
                } else {
                    value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function without return type, but {1} returns a template of type `{2}''", getTypename(), assignment.getDescription(), assignment.getType(timestamp).getTypename()));
                }
                break;
            }
        case A_FUNCTION_RVAL:
        case A_EXT_FUNCTION_RVAL:
            if (returnType != null) {
                final IType tempReturnType = assignment.getType(timestamp);
                if (!returnType.isIdentical(timestamp, tempReturnType)) {
                    value.getLocation().reportSemanticError(MessageFormat.format("Return type mismatch: type `{0}'' expects a function or external function that returns a {1} of type `{2}''," + " but {3} returns a value of type `{3}''", getTypename(), returnsTemplate ? "template" : "value", returnType.getTypename(), assignment.getDescription(), tempReturnType.getTypename()));
                } else if (returnsTemplate) {
                    value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function that returns a template of type `{1}'', but {2} returns a value", getTypename(), returnType.getTypename(), assignment.getDescription()));
                }
            } else {
                value.getLocation().reportSemanticError(MessageFormat.format("Type `{0}'' expects a function or external function without return type, but {1} returns a value of type `{2}''", getTypename(), assignment.getDescription(), assignment.getType(timestamp).getTypename()));
            }
            break;
        default:
            break;
    }
    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 : Assignment(org.eclipse.titan.designer.AST.Assignment) IValue(org.eclipse.titan.designer.AST.IValue) Scope(org.eclipse.titan.designer.AST.Scope) RunsOnScope(org.eclipse.titan.designer.AST.TTCN3.definitions.RunsOnScope) Restriction_type(org.eclipse.titan.designer.AST.TTCN3.TemplateRestriction.Restriction_type) Def_Function(org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Function) IType(org.eclipse.titan.designer.AST.IType) RunsOnScope(org.eclipse.titan.designer.AST.TTCN3.definitions.RunsOnScope)

Example 22 with Omit_Value

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

the class ObjectID_Type method checkThisValue.

@Override
public /**
 * {@inheritDoc}
 */
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
    value.setIsErroneous(false);
    final 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;
    }
    if (Value_type.UNDEFINED_BLOCK.equals(last.getValuetype())) {
        last = last.setValuetype(timestamp, Value_type.OBJECTID_VALUE);
    }
    if (last.getIsErroneous(timestamp)) {
        return selfReference;
    }
    switch(last.getValuetype()) {
        case OBJECTID_VALUE:
            final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
            ((ObjectIdentifier_Value) last).checkOID(timestamp, referenceChain);
            referenceChain.release();
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            if (value.isAsn()) {
                value.getLocation().reportSemanticError(OBJIDVALUEEXPECTED1);
            } else {
                value.getLocation().reportSemanticError(OBJIDVALUEEXPECTED2);
            }
            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) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ObjectIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.ObjectIdentifier_Value)

Example 23 with Omit_Value

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

the class SubType method checkThisTemplateGeneric.

/**
 * Does the semantic checking of the provided template according to the
 * a specific sub-type.
 *
 * @param timestamp
 *                the time stamp of the actual semantic check cycle.
 * @param template
 *                the template to be checked by the type.
 */
public void checkThisTemplateGeneric(final CompilationTimeStamp timestamp, final ITTCN3Template template) {
    if (getIsErroneous(timestamp) || (subtypeConstraint == null)) {
        return;
    }
    if (template.getIsErroneous(timestamp)) {
        return;
    }
    final TTCN3Template t = template.getTemplateReferencedLast(timestamp);
    if (t.getIsErroneous(timestamp)) {
        return;
    }
    switch(t.getTemplatetype()) {
        case OMIT_VALUE:
        case ANY_OR_OMIT:
        case ANY_VALUE:
        case VALUE_LIST:
        case COMPLEMENTED_LIST:
        case SPECIFIC_VALUE:
        case TEMPLATE_REFD:
        case TEMPLATE_INVOKE:
            break;
        case TEMPLATE_LIST:
            if ((subtypeType == SubType_type.ST_RECORDOF) || (subtypeType == SubType_type.ST_SETOF)) {
                if ((lengthRestriction == null) || (lengthRestriction.isEmpty() == TernaryBool.TTRUE)) {
                    break;
                }
                final SizeLimit minLimit = (SizeLimit) lengthRestriction.getMinimal();
                final SizeLimit maxLimit = (SizeLimit) lengthRestriction.getMaximal();
                final Template_List list = (Template_List) template;
                final int fixComponents = list.getNofTemplatesNotAnyornone(timestamp);
                if (!list.templateContainsAnyornone() && (fixComponents < minLimit.getSize().intValue())) {
                    template.getLocation().reportSemanticError(MessageFormat.format("At least {0} elements must be present in the list", minLimit.getSize().intValue()));
                    return;
                } else if (!maxLimit.getInfinity() && (fixComponents > maxLimit.getSize().intValue())) {
                    template.getLocation().reportSemanticError(MessageFormat.format("There must not be more than {0} elements in the list", maxLimit.getSize().intValue()));
                    return;
                }
            }
            // and set types
            break;
        case INDEXED_TEMPLATE_LIST:
        case NAMED_TEMPLATE_LIST:
        case VALUE_RANGE:
            // FIXME implement checking
            break;
        case SUPERSET_MATCH:
            {
                if (subtypeType != SubType_type.ST_SETOF) {
                    template.getLocation().reportSemanticError("'superset' template matching mechanism can be used only with 'set of' types");
                }
                final SupersetMatch_Template temp = (SupersetMatch_Template) template;
                for (int i = 0, size = temp.getNofTemplates(); i < size; i++) {
                    checkThisTemplateGeneric(timestamp, temp.getTemplateByIndex(i));
                }
                break;
            }
        case SUBSET_MATCH:
            {
                if (subtypeType != SubType_type.ST_SETOF) {
                    template.getLocation().reportSemanticError("'subset' template matching mechanism can be used only with 'set of' types");
                }
                final SubsetMatch_Template temp = (SubsetMatch_Template) template;
                for (int i = 0, size = temp.getNofTemplates(); i < size; i++) {
                    checkThisTemplateGeneric(timestamp, temp.getTemplateByIndex(i));
                }
                break;
            }
        case BSTR_PATTERN:
            checkThisTemplatePattern(template, "bitstring", ((BitString_Pattern_Template) template).getMinLengthOfPattern(), ((BitString_Pattern_Template) template).containsAnyornoneSymbol());
            break;
        case HSTR_PATTERN:
            checkThisTemplatePattern(template, "hexstring", ((HexString_Pattern_Template) template).getMinLengthOfPattern(), ((HexString_Pattern_Template) template).containsAnyornoneSymbol());
            break;
        case OSTR_PATTERN:
            checkThisTemplatePattern(template, "octetstring", ((OctetString_Pattern_Template) template).getMinLengthOfPattern(), ((OctetString_Pattern_Template) template).containsAnyornoneSymbol());
            break;
        case CSTR_PATTERN:
            checkThisTemplatePattern(template, "charstring", ((CharString_Pattern_Template) template).getMinLengthOfPattern(), ((CharString_Pattern_Template) template).patternContainsAnyornoneSymbol());
            break;
        case USTR_PATTERN:
            checkThisTemplatePattern(template, "universal charstring", ((UnivCharString_Pattern_Template) template).getMinLengthOfPattern(), ((UnivCharString_Pattern_Template) template).patternContainsAnyornoneSymbol());
            break;
        default:
            break;
    }
    checkThisTemplateLengthRestriction(timestamp, t);
}
Also used : Template_List(org.eclipse.titan.designer.AST.TTCN3.templates.Template_List) SubsetMatch_Template(org.eclipse.titan.designer.AST.TTCN3.templates.SubsetMatch_Template) ITTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template) TTCN3Template(org.eclipse.titan.designer.AST.TTCN3.templates.TTCN3Template) SupersetMatch_Template(org.eclipse.titan.designer.AST.TTCN3.templates.SupersetMatch_Template)

Example 24 with Omit_Value

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

the class TTCN3_Set_Type method checkThisValueSet.

/**
 * Checks the Set_Value kind value against this type.
 * <p>
 * Please note, that this function can only be called once we know for sure
 * that the value is of set type.
 *
 * @param timestamp the timestamp of the actual semantic check cycle.
 * @param value the value to be checked
 * @param expectedValue the kind of value we expect to find.
 * @param incompleteAllowed wheather incomplete value is allowed or not.
 * @param impliciOmit true if the implicit omit optional attribute was set
 *            for the value, false otherwise
 */
private boolean checkThisValueSet(final CompilationTimeStamp timestamp, final Set_Value value, final Assignment lhs, final Expected_Value_type expectedValue, final boolean incompleteAllowed, final boolean impliciOmit, final boolean strElem) {
    value.removeGeneratedValues();
    boolean selfReference = false;
    final Map<String, NamedValue> componentMap = new HashMap<String, NamedValue>();
    final Map<String, CompField> realComponents = compFieldMap.getComponentFieldMap(timestamp);
    final boolean isAsn = value.isAsn();
    final int nofValueComponents = value.getNofComponents();
    for (int i = 0; i < nofValueComponents; i++) {
        final NamedValue namedValue = value.getSequenceValueByIndex(i);
        final Identifier valueId = namedValue.getName();
        if (!realComponents.containsKey(valueId.getName())) {
            namedValue.getLocation().reportSemanticError(MessageFormat.format(isAsn ? NONEXISTENTFIELDASN1 : NONEXISTENTFIELDTTCN3, namedValue.getName().getDisplayName(), getTypename()));
        } else {
            if (componentMap.containsKey(valueId.getName())) {
                namedValue.getLocation().reportSemanticError(MessageFormat.format(isAsn ? DUPLICATEFIELDAGAINASN1 : DUPLICATEFIELDAGAINTTCN3, valueId.getDisplayName()));
                componentMap.get(valueId.getName()).getLocation().reportSingularSemanticError(MessageFormat.format(isAsn ? DUPLICATEFIELDFIRSTASN1 : DUPLICATEFIELDFIRSTTTCN3, valueId.getDisplayName()));
            } else {
                componentMap.put(valueId.getName(), namedValue);
            }
            final CompField componentField = realComponents.get(valueId.getName());
            final Type type = componentField.getType();
            final IValue componentValue = namedValue.getValue();
            if (componentValue != null) {
                componentValue.setMyGovernor(type);
                if (Value_type.NOTUSED_VALUE.equals(componentValue.getValuetype())) {
                    if (!incompleteAllowed) {
                        componentValue.getLocation().reportSemanticError(INCOMPLETEPRESENTERROR);
                    }
                } else {
                    final IValue tempValue = type.checkThisValueRef(timestamp, componentValue);
                    selfReference |= type.checkThisValue(timestamp, tempValue, lhs, new ValueCheckingOptions(expectedValue, incompleteAllowed, componentField.isOptional(), true, impliciOmit, strElem));
                }
            }
        }
    }
    if (!incompleteAllowed || strictConstantCheckingSeverity) {
        final int nofTypeComponents = realComponents.size();
        CompField field;
        for (int i = 0; i < nofTypeComponents; i++) {
            field = compFieldMap.fields.get(i);
            final Identifier id = field.getIdentifier();
            if (!componentMap.containsKey(id.getName())) {
                if (field.isOptional() && impliciOmit) {
                    value.addNamedValue(new NamedValue(new Identifier(Identifier_type.ID_TTCN, id.getDisplayName()), new Omit_Value(), false));
                } else {
                    value.getLocation().reportSemanticError(MessageFormat.format(isAsn ? MISSINGFIELDASN1 : MISSINGFIELDTTCN3, id.getDisplayName()));
                }
            }
        }
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : HashMap(java.util.HashMap) NamedValue(org.eclipse.titan.designer.AST.TTCN3.values.NamedValue) ASN1_Set_Type(org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Type) Type(org.eclipse.titan.designer.AST.Type) SubType(org.eclipse.titan.designer.AST.TTCN3.types.subtypes.SubType) IType(org.eclipse.titan.designer.AST.IType) Identifier(org.eclipse.titan.designer.AST.Identifier) IValue(org.eclipse.titan.designer.AST.IValue) Omit_Value(org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value)

Example 25 with Omit_Value

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

the class ASN1_Set_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.SET_VALUE);
            if (last.isAsn()) {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, false, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            } else {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            }
            break;
        case SEQUENCEOF_VALUE:
            if (((SequenceOf_Value) last).isIndexed()) {
                value.getLocation().reportSemanticError(MessageFormat.format("Indexed assignment notation cannot be used for SET type `{0}''", getFullName()));
                value.setIsErroneous(true);
            } else {
                final SequenceOf_Value temporalValue = (SequenceOf_Value) last;
                if (temporalValue.getNofComponents() == 0) {
                    if (getNofComponents(timestamp) == 0) {
                        last = last.setValuetype(timestamp, Value_type.SET_VALUE);
                    } else {
                        value.getLocation().reportSemanticError(MessageFormat.format(NONEMPTYEXPECTED, getFullName()));
                        value.setIsErroneous(true);
                    }
                } else {
                    value.getLocation().reportSemanticError(MessageFormat.format(last.isAsn() ? VALUELISTNOTATIONERRORASN1 : VALUELISTNOTATIONERRORTTCN3, getFullName()));
                    value.setIsErroneous(true);
                }
            }
            break;
        case SET_VALUE:
            if (last.isAsn()) {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, false, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            } else {
                selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, valueCheckingOptions.incomplete_allowed, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            }
            break;
        case UNDEFINED_BLOCK:
            last = last.setValuetype(timestamp, Value_type.SET_VALUE);
            selfReference = checkThisValueSet(timestamp, (Set_Value) last, lhs, valueCheckingOptions.expected_value, false, valueCheckingOptions.implicit_omit, valueCheckingOptions.str_elem);
            break;
        case EXPRESSION_VALUE:
        case MACRO_VALUE:
            // already checked
            break;
        default:
            value.getLocation().reportSemanticError(MessageFormat.format(last.isAsn() ? SETVALUEXPECTEDASN1 : SETVALUEXPECTEDTTCN3, getFullName()));
            value.setIsErroneous(true);
    }
    value.setLastTimeChecked(timestamp);
    return selfReference;
}
Also used : IValue(org.eclipse.titan.designer.AST.IValue) SequenceOf_Value(org.eclipse.titan.designer.AST.TTCN3.values.SequenceOf_Value) Set_Value(org.eclipse.titan.designer.AST.TTCN3.values.Set_Value)

Aggregations

IValue (org.eclipse.titan.designer.AST.IValue)33 IType (org.eclipse.titan.designer.AST.IType)15 Identifier (org.eclipse.titan.designer.AST.Identifier)13 CompField (org.eclipse.titan.designer.AST.TTCN3.types.CompField)8 Omit_Value (org.eclipse.titan.designer.AST.TTCN3.values.Omit_Value)7 BridgingNamedNode (org.eclipse.titan.designer.AST.BridgingNamedNode)6 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)6 ISubReference (org.eclipse.titan.designer.AST.ISubReference)6 NamedValue (org.eclipse.titan.designer.AST.TTCN3.values.NamedValue)6 Value (org.eclipse.titan.designer.AST.Value)6 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)5 HashMap (java.util.HashMap)4 ASN1_Sequence_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Sequence_Type)4 SequenceOf_Value (org.eclipse.titan.designer.AST.TTCN3.values.SequenceOf_Value)4 Type (org.eclipse.titan.designer.AST.Type)4 ASN1_Set_Type (org.eclipse.titan.designer.AST.ASN1.types.ASN1_Set_Type)3 Assignment (org.eclipse.titan.designer.AST.Assignment)3 ReferenceChain (org.eclipse.titan.designer.AST.ReferenceChain)3 Sequence_Value (org.eclipse.titan.designer.AST.TTCN3.values.Sequence_Value)3 IASN1Type (org.eclipse.titan.designer.AST.ASN1.IASN1Type)2