Search in sources :

Example 6 with Object_Definition

use of org.eclipse.titan.designer.AST.ASN1.Object.Object_Definition in project titan.EclipsePlug-ins by eclipse.

the class Undefined_FieldSpecification method classifyFieldSpecification.

private void classifyFieldSpecification(final CompilationTimeStamp timestamp) {
    final IReferenceChain temporalReferenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
    if (isOptional && (null != defaultSetting1 || null != mDefaultSetting)) {
        location.reportSemanticError("OPTIONAL and DEFAULT are mutually exclusive");
        isOptional = false;
    }
    if (temporalReferenceChain.add(this) && null != governorReference) {
        governorReference.setMyScope(myObjectClass.getMyScope());
        if (null != defaultSetting1) {
            defaultSetting1.setMyScope(myObjectClass.getMyScope());
        }
        if (identifier.isvalidAsnObjectSetFieldReference() && governorReference.refersToSettingType(timestamp, Setting_type.S_OC, temporalReferenceChain)) {
            ObjectSet defaultObjectset = null;
            if (null != mDefaultSetting) {
                defaultObjectset = new ObjectSet_definition(mDefaultSetting);
            }
            final ObjectClass_refd oc = new ObjectClass_refd(governorReference);
            oc.setLocation(governorReference.getLocation());
            fieldSpecification = new ObjectSet_FieldSpecification(identifier, oc, isOptional, defaultObjectset);
        } else if (identifier.isvalidAsnObjectFieldReference() && governorReference.refersToSettingType(timestamp, Setting_type.S_OC, temporalReferenceChain)) {
            ASN1Object defaultObject = null;
            if (null != defaultSetting1) {
                defaultObject = new ReferencedObject(defaultSetting1);
            } else if (null != mDefaultSetting) {
                defaultObject = new Object_Definition(mDefaultSetting);
            }
            fieldSpecification = new Object_FieldSpecification(identifier, new ObjectClass_refd(governorReference), isOptional, defaultObject);
        } else if (identifier.isvalidAsnValueFieldReference() && (governorReference.refersToSettingType(timestamp, Setting_type.S_T, temporalReferenceChain) || governorReference.refersToSettingType(timestamp, Setting_type.S_VS, temporalReferenceChain))) {
            IValue defaultValue = null;
            if (null != defaultSetting1) {
                if (defaultSetting1 instanceof Defined_Reference && null == defaultSetting1.getModuleIdentifier()) {
                    defaultValue = new Undefined_LowerIdentifier_Value(defaultSetting1.getId().newInstance());
                } else {
                    defaultValue = new Referenced_Value(defaultSetting1);
                }
            } else if (null != mDefaultSetting) {
                defaultValue = new Undefined_Block_Value(mDefaultSetting);
            }
            fieldSpecification = new FixedTypeValue_FieldSpecification(identifier, new Referenced_Type(governorReference), false, isOptional, null != defaultSetting1 && null != mDefaultSetting, defaultValue);
        }
    }
    if (null == fieldSpecification) {
        location.reportSemanticError(CANNOTRECOGNISE);
        fieldSpecification = new Erroneous_FieldSpecification(identifier, isOptional, null != defaultSetting1 || null != mDefaultSetting);
    } else {
        if (null != myObjectClass) {
            fieldSpecification.setMyObjectClass(myObjectClass);
        }
    }
    fieldSpecification.setFullNameParent(getNameParent());
    fieldSpecification.setLocation(location);
    temporalReferenceChain.release();
}
Also used : Defined_Reference(org.eclipse.titan.designer.AST.ASN1.Defined_Reference) Referenced_Value(org.eclipse.titan.designer.AST.TTCN3.values.Referenced_Value) ObjectSet(org.eclipse.titan.designer.AST.ASN1.ObjectSet) IValue(org.eclipse.titan.designer.AST.IValue) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) Undefined_Block_Value(org.eclipse.titan.designer.AST.ASN1.values.Undefined_Block_Value) ASN1Object(org.eclipse.titan.designer.AST.ASN1.ASN1Object) Referenced_Type(org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type) Undefined_LowerIdentifier_Value(org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value)

Example 7 with Object_Definition

use of org.eclipse.titan.designer.AST.ASN1.Object.Object_Definition in project titan.EclipsePlug-ins by eclipse.

the class ObjectSetElementVisitor_objectCollector method visitObject.

@Override
public /**
 * {@inheritDoc}
 */
void visitObject(final ASN1Object p) {
    final Object_Definition object = p.getRefdLast(timestamp, null);
    if (object.getIsErroneous(timestamp)) {
        return;
    }
    if (visitedElements.contains(object)) {
        return;
    }
    final ObjectClass myClass = governor.getRefdLast(timestamp, null);
    final ObjectClass refdClass = object.getMyGovernor().getRefdLast(timestamp, null);
    if (myClass != refdClass) {
        if (location != NULL_Location.INSTANCE && refdClass != null) {
            location.reportSemanticError(MessageFormat.format(OBJECTOFCLASSEXPECTED, myClass.getFullName(), p.getFullName(), refdClass.getFullName()));
        }
        return;
    }
    visitedElements.add(object);
    objects.addObject(object);
}
Also used : ObjectClass(org.eclipse.titan.designer.AST.ASN1.ObjectClass)

Example 8 with Object_Definition

use of org.eclipse.titan.designer.AST.ASN1.Object.Object_Definition in project titan.EclipsePlug-ins by eclipse.

the class ReferencedObject method getRefdLast.

public Object_Definition getRefdLast(final CompilationTimeStamp timestamp) {
    final IReferenceChain referenceChain = ReferenceChain.getInstance(CIRCULAROBJECTREFERENCE, true);
    ASN1Object object = this;
    while (object instanceof ReferencedObject && !object.getIsErroneous(timestamp)) {
        object = ((ReferencedObject) object).getRefd(timestamp, referenceChain);
    }
    referenceChain.release();
    return (Object_Definition) object;
}
Also used : IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ASN1Object(org.eclipse.titan.designer.AST.ASN1.ASN1Object)

Aggregations

Object_Definition (org.eclipse.titan.designer.AST.ASN1.Object.Object_Definition)3 ObjectClass (org.eclipse.titan.designer.AST.ASN1.ObjectClass)3 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)3 Referenced_Type (org.eclipse.titan.designer.AST.TTCN3.types.Referenced_Type)3 ASN1Object (org.eclipse.titan.designer.AST.ASN1.ASN1Object)2 ObjectSet_definition (org.eclipse.titan.designer.AST.ASN1.Object.ObjectSet_definition)2 ReferencedObject (org.eclipse.titan.designer.AST.ASN1.Object.ReferencedObject)2 ObjectClassField_Type (org.eclipse.titan.designer.AST.ASN1.types.ObjectClassField_Type)2 Open_Type (org.eclipse.titan.designer.AST.ASN1.types.Open_Type)2 Undefined_Block_Value (org.eclipse.titan.designer.AST.ASN1.values.Undefined_Block_Value)2 ISetting (org.eclipse.titan.designer.AST.ISetting)2 Identifier (org.eclipse.titan.designer.AST.Identifier)2 Undefined_LowerIdentifier_Value (org.eclipse.titan.designer.AST.TTCN3.values.Undefined_LowerIdentifier_Value)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Defined_Reference (org.eclipse.titan.designer.AST.ASN1.Defined_Reference)1 ASN1Objects (org.eclipse.titan.designer.AST.ASN1.Object.ASN1Objects)1 FieldSetting (org.eclipse.titan.designer.AST.ASN1.Object.FieldSetting)1 FieldSetting_ObjectSet (org.eclipse.titan.designer.AST.ASN1.Object.FieldSetting_ObjectSet)1 FieldSetting_Type (org.eclipse.titan.designer.AST.ASN1.Object.FieldSetting_Type)1 FieldSpecification (org.eclipse.titan.designer.AST.ASN1.Object.FieldSpecification)1