Search in sources :

Example 46 with ISubReference

use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.

the class ObjectSet_definition method addProposal.

@Override
public final /**
 * {@inheritDoc}
 */
void addProposal(final ProposalCollector propCollector, final int i) {
    final List<ISubReference> subreferences = propCollector.getReference().getSubreferences();
    if (subreferences.size() <= i) {
        return;
    }
    final ISubReference subreference = subreferences.get(i);
    if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
        if (subreferences.size() > i + 1) {
            // the reference might go on
            Object_Definition def;
            for (int j = 0; j < objects.getNofObjects(); j++) {
                def = objects.getObjectByIndex(j);
                def.addProposal(propCollector, i + 1);
            }
        } else {
            // final part of the reference
            Object_Definition def;
            for (int j = 0; j < objects.getNofObjects(); j++) {
                def = objects.getObjectByIndex(j);
                def.addProposal(propCollector, i);
            }
        }
    }
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference)

Example 47 with ISubReference

use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.

the class Object_Definition method addProposal.

@Override
public /**
 * {@inheritDoc}
 */
void addProposal(final ProposalCollector propCollector, final int i) {
    final List<ISubReference> subreferences = propCollector.getReference().getSubreferences();
    if (subreferences.size() <= i) {
        return;
    }
    final ISubReference subreference = subreferences.get(i);
    final String subreferenceName = subreference.getId().getName();
    if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
        if (subreferences.size() > i + 1) {
            // the reference might go on
            final FieldSetting fieldSetting = fieldSettingMap.get(subreferenceName);
            if (null == fieldSetting) {
                return;
            }
            fieldSetting.addProposal(propCollector, i + 1);
        } else {
            // final part of the reference
            for (int j = 0; j < fieldSettings.size(); j++) {
                final FieldSetting fieldSetting = fieldSettings.get(i);
                if (fieldSetting.getName().getName().startsWith(subreferenceName)) {
                    propCollector.addProposal(fieldSetting.getName(), "- Object field", null, "FieldSetting");
                }
            }
        }
    }
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference)

Example 48 with ISubReference

use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.

the class Object_Definition method addDeclaration.

@Override
public /**
 * {@inheritDoc}
 */
void addDeclaration(final DeclarationCollector declarationCollector, final int i) {
    final List<ISubReference> subreferences = declarationCollector.getReference().getSubreferences();
    if (subreferences.size() <= i) {
        return;
    }
    final ISubReference subreference = subreferences.get(i);
    final String subreferenceName = subreference.getId().getName();
    if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
        if (subreferences.size() > i + 1) {
            // the reference might go on
            final FieldSetting fieldSetting = fieldSettingMap.get(subreferenceName);
            if (null == fieldSetting) {
                return;
            }
            fieldSetting.addDeclaration(declarationCollector, i + 1);
        } else {
            // final part of the reference
            String name;
            for (int j = 0; j < fieldSettings.size(); j++) {
                final FieldSetting fieldSetting = fieldSettings.get(i);
                name = fieldSetting.getName().getName();
                if (name.startsWith(subreferenceName)) {
                    declarationCollector.addDeclaration(name, fieldSetting.getLocation(), this);
                }
            }
        }
    }
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference)

Example 49 with ISubReference

use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.

the class Erroneous_FieldSpecification method addProposal.

@Override
public /**
 * {@inheritDoc}
 */
void addProposal(final ProposalCollector propCollector, final int i) {
    final List<ISubReference> subreferences = propCollector.getReference().getSubreferences();
    if (subreferences.size() <= i) {
        return;
    }
    final ISubReference subreference = subreferences.get(i);
    if (Subreference_type.fieldSubReference.equals(subreference.getReferenceType())) {
        if (subreferences.size() == i + 1) {
            propCollector.addProposal(identifier, " - unknown fieldspeciication", null, "unknown fieldspeciication");
        }
    }
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference)

Example 50 with ISubReference

use of org.eclipse.titan.designer.AST.ISubReference in project titan.EclipsePlug-ins by eclipse.

the class Parameterised_Reference method getRefDefdSimple.

/**
 * Resolve the formal parameters of the referenced assignment with the
 * help of the actual parameters. Instantiate a new assignment from it
 * and return a reference to this assignment.
 *
 * @return the reference to the newly instantiated assignment.
 */
public Defined_Reference getRefDefdSimple() {
    final Module module = myScope.getModuleScope();
    // This is a little trick, but otherwise we would not have the
    // true compilation timestamp
    final CompilationTimeStamp compilationTimeStamp = module.getLastImportationCheckTimeStamp();
    if (compilationTimeStamp == null) {
        // compilationTimeStamp = CompilationTimeStamp.getNewCompilationCounter(); //this forces re-check
        return null;
    }
    if (null != lastCheckTimeStamp && !lastCheckTimeStamp.isLess(compilationTimeStamp)) {
        if (isErroneous) {
            return null;
        }
        return finalReference;
    }
    lastCheckTimeStamp = compilationTimeStamp;
    final Assignment parass = assignmentReference.getRefdAssignment(compilationTimeStamp, true, null);
    if (null == parass) {
        isErroneous = true;
        return null;
    } else if (!(parass instanceof ASN1Assignment)) {
        assignmentReference.getLocation().reportSemanticError(ASSIGNMENTEXPECTED);
        isErroneous = true;
        return null;
    }
    final Ass_pard assPard = ((ASN1Assignment) parass).getAssPard();
    if (null == assPard) {
        assignmentReference.getLocation().reportSemanticError(PARAMETERISEDASSIGNMENTEXPECTED);
        isErroneous = true;
        return assignmentReference;
    }
    addAssignments(assPard, compilationTimeStamp);
    // Add the assignments made from the formal and actual
    // parameters to the actual module
    assignments.setRightScope(myScope);
    assignments.setParentScope(parass.getMyScope());
    assignments.setFullNameParent(this);
    assignments.check(compilationTimeStamp);
    // create a copy of the assignment and add it to the actual
    // module
    final ASN1Assignment newAssignment = ((ASN1Assignment) parass).newInstance(module);
    newAssignmentNameStart = new NameReStarter(new StringBuilder(module.getFullName()).append(INamedNode.DOT).append(newAssignment.getIdentifier().getDisplayName()).toString());
    newAssignmentNameStart.setFullNameParent(parass);
    newAssignment.setFullNameParent(newAssignmentNameStart);
    newAssignment.setLocation(location);
    newAssignment.getIdentifier().setLocation(assignmentReference.getLocation());
    ((ASN1Assignments) module.getAssignments()).addDynamicAssignment(compilationTimeStamp, newAssignment);
    newAssignment.setMyScope(assignments);
    newAssignment.check(compilationTimeStamp);
    final List<ISubReference> subreferences = new ArrayList<ISubReference>(1);
    subreferences.add(new FieldSubReference(newAssignment.getIdentifier()));
    finalReference = new Defined_Reference(module.getIdentifier(), subreferences);
    finalReference.setFullNameParent(this);
    finalReference.setMyScope(module);
    return finalReference;
}
Also used : FieldSubReference(org.eclipse.titan.designer.AST.FieldSubReference) ArrayList(java.util.ArrayList) NameReStarter(org.eclipse.titan.designer.AST.NameReStarter) Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) CompilationTimeStamp(org.eclipse.titan.designer.parsers.CompilationTimeStamp) Module(org.eclipse.titan.designer.AST.Module)

Aggregations

ISubReference (org.eclipse.titan.designer.AST.ISubReference)205 IType (org.eclipse.titan.designer.AST.IType)80 IValue (org.eclipse.titan.designer.AST.IValue)63 Identifier (org.eclipse.titan.designer.AST.Identifier)53 Value (org.eclipse.titan.designer.AST.Value)47 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)46 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)40 Assignment (org.eclipse.titan.designer.AST.Assignment)28 CompField (org.eclipse.titan.designer.AST.TTCN3.types.CompField)25 Reference (org.eclipse.titan.designer.AST.Reference)18 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)15 ArrayList (java.util.ArrayList)14 Template (org.eclipse.jface.text.templates.Template)11 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)11 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)11 Expected_Value_type (org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type)10 BridgingNamedNode (org.eclipse.titan.designer.AST.BridgingNamedNode)8 Module (org.eclipse.titan.designer.AST.Module)8 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)7 ActualParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)6