Search in sources :

Example 31 with FormalParameter

use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter in project titan.EclipsePlug-ins by eclipse.

the class ParsedActualParameters method findReferences.

@Override
public /**
 * {@inheritDoc}
 */
void findReferences(final ReferenceFinder referenceFinder, final List<Hit> foundIdentifiers) {
    if (unnamedPart != null) {
        unnamedPart.findReferences(referenceFinder, foundIdentifiers);
    }
    if (namedPart != null) {
        if (formalParList != null) {
            for (int i = 0; i < namedPart.getNofParams(); i++) {
                final Identifier parName = namedPart.getParamByIndex(i).getName();
                final FormalParameter fp = formalParList.getParameterById(parName);
                if (fp == referenceFinder.assignment) {
                    foundIdentifiers.add(new Hit(parName));
                }
            }
        }
        namedPart.findReferences(referenceFinder, foundIdentifiers);
    }
}
Also used : FormalParameter(org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter) Hit(org.eclipse.titan.designer.AST.ReferenceFinder.Hit) Identifier(org.eclipse.titan.designer.AST.Identifier)

Example 32 with FormalParameter

use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter in project titan.EclipsePlug-ins by eclipse.

the class Function_Type method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    final String genName = getGenNameOwn();
    final String displayName = getFullName();
    generateCodeTypedescriptor(aData, source);
    final FunctionReferenceDefinition def = new FunctionReferenceDefinition(genName, displayName);
    if (returnType == null) {
        def.returnType = null;
    } else {
        if (returnsTemplate) {
            def.returnType = returnType.getGenNameTemplate(aData, source, myScope);
        } else {
            def.returnType = returnType.getGenNameValue(aData, source, myScope);
        }
    }
    def.type = fatType.FUNCTION;
    def.runsOnSelf = runsOnSelf;
    def.isStartable = isStartable;
    def.formalParList = formalParList.generateCode(aData).toString();
    def.actualParList = formalParList.generateCodeActualParlist("").toString();
    def.parameterTypeNames = new ArrayList<String>(formalParList.getNofParameters());
    def.parameterNames = new ArrayList<String>(formalParList.getNofParameters());
    for (int i = 0; i < formalParList.getNofParameters(); i++) {
        final FormalParameter formalParameter = formalParList.getParameterByIndex(i);
        switch(formalParameter.getAssignmentType()) {
            case A_PAR_VAL:
            case A_PAR_VAL_IN:
            case A_PAR_VAL_INOUT:
            case A_PAR_VAL_OUT:
                def.parameterTypeNames.add(formalParameter.getType(CompilationTimeStamp.getBaseTimestamp()).getGenNameValue(aData, source, getMyScope()));
                break;
            case A_PAR_TEMP_IN:
            case A_PAR_TEMP_INOUT:
            case A_PAR_TEMP_OUT:
                def.parameterTypeNames.add(formalParameter.getType(CompilationTimeStamp.getBaseTimestamp()).getGenNameTemplate(aData, source, getMyScope()));
                break;
            default:
                break;
        }
        def.parameterNames.add(formalParameter.getIdentifier().getName());
    }
    FunctionReferenceGenerator.generateValueClass(aData, source, def);
    FunctionReferenceGenerator.generateTemplateClass(aData, source, def);
    if (hasDoneAttribute()) {
        generateCodeDone(aData, source);
    }
    if (subType != null) {
        subType.generateCode(aData, source);
    }
    generateCodeForCodingHandlers(aData, source);
}
Also used : FormalParameter(org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter) FunctionReferenceDefinition(org.eclipse.titan.designer.AST.TTCN3.types.FunctionReferenceGenerator.FunctionReferenceDefinition)

Aggregations

FormalParameter (org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter)18 IType (org.eclipse.titan.designer.AST.IType)12 Assignment (org.eclipse.titan.designer.AST.Assignment)9 Type (org.eclipse.titan.designer.AST.Type)8 CodeSectionType (org.eclipse.titan.designer.AST.GovernedSimple.CodeSectionType)4 IValue (org.eclipse.titan.designer.AST.IValue)4 Identifier (org.eclipse.titan.designer.AST.Identifier)4 Reference (org.eclipse.titan.designer.AST.Reference)4 Def_Var (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Var)4 TemplateInstance (org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance)4 HashMap (java.util.HashMap)3 ISubReference (org.eclipse.titan.designer.AST.ISubReference)3 Def_Var_Template (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Var_Template)3 Definition (org.eclipse.titan.designer.AST.TTCN3.definitions.Definition)3 ITTCN3Template (org.eclipse.titan.designer.AST.TTCN3.templates.ITTCN3Template)3 FunctionReferenceDefinition (org.eclipse.titan.designer.AST.TTCN3.types.FunctionReferenceGenerator.FunctionReferenceDefinition)3 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)2 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)2 Location (org.eclipse.titan.designer.AST.Location)2 Module (org.eclipse.titan.designer.AST.Module)2