Search in sources :

Example 6 with ParameterisedSubReference

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

the class Testcase_Instance_Statement method generateCode.

@Override
public /**
 * {@inheritDoc}
 */
void generateCode(final JavaGenData aData, final StringBuilder source) {
    source.append("\t\t");
    final ExpressionStruct expression = new ExpressionStruct();
    final Assignment testcase = testcaseReference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
    expression.expression.append(MessageFormat.format("{0}(", testcase.getGenNameFromScope(aData, source, myScope, "testcase_")));
    final List<ISubReference> subReferences = testcaseReference.getSubreferences();
    if (!subReferences.isEmpty() && subReferences.get(0) instanceof ParameterisedSubReference) {
        final ActualParameterList actualParList = ((ParameterisedSubReference) subReferences.get(0)).getActualParameters();
        if (actualParList.getNofParameters() > 0) {
            actualParList.generateCodeAlias(aData, expression);
            expression.expression.append(", ");
        }
    }
    if (timerValue != null) {
        expression.expression.append("true, ");
        timerValue.generateCodeExpression(aData, expression, true);
        expression.expression.append(')');
    } else {
        aData.addBuiltinTypeImport("TitanFloat");
        aData.addBuiltinTypeImport("Ttcn3Float");
        expression.expression.append("false, new TitanFloat( new Ttcn3Float( 0.0 ) ))");
    }
    expression.mergeExpression(source);
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) ExpressionStruct(org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct) ActualParameterList(org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)

Example 7 with ParameterisedSubReference

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

the class Template_ActualParameter method checkRecursions.

@Override
public /**
 * {@inheritDoc}
 */
void checkRecursions(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
    if (template == null) {
        return;
    }
    final Reference derivedReference = template.getDerivedReference();
    if (derivedReference != null) {
        final ISubReference subReference = derivedReference.getSubreferences().get(0);
        if (subReference instanceof ParameterisedSubReference) {
            final ActualParameterList parameterList = ((ParameterisedSubReference) subReference).getActualParameters();
            if (parameterList != null) {
                parameterList.checkRecursions(timestamp, referenceChain);
            }
        }
    }
    referenceChain.markState();
    template.getTemplateBody().checkRecursions(timestamp, referenceChain);
    referenceChain.previousState();
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) Reference(org.eclipse.titan.designer.AST.Reference) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference)

Example 8 with ParameterisedSubReference

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

the class ExecuteExpression method generateCodeExpressionExpression.

@Override
public /**
 * {@inheritDoc}
 */
void generateCodeExpressionExpression(final JavaGenData aData, final ExpressionStruct expression) {
    final Assignment testcase = reference.getRefdAssignment(CompilationTimeStamp.getBaseTimestamp(), false);
    expression.expression.append(MessageFormat.format("{0}(", testcase.getGenNameFromScope(aData, expression.expression, myScope, "testcase_")));
    final List<ISubReference> subReferences = reference.getSubreferences();
    if (!subReferences.isEmpty() && subReferences.get(0) instanceof ParameterisedSubReference) {
        final ActualParameterList actualParList = ((ParameterisedSubReference) subReferences.get(0)).getActualParameters();
        if (actualParList.getNofParameters() > 0) {
            actualParList.generateCodeAlias(aData, expression);
            expression.expression.append(", ");
        }
    }
    if (timerValue != null) {
        expression.expression.append("true, ");
        timerValue.generateCodeExpression(aData, expression, true);
        expression.expression.append(')');
    } else {
        expression.expression.append("false, new TitanFloat( new Ttcn3Float( 0.0 ) ))");
    }
}
Also used : Assignment(org.eclipse.titan.designer.AST.Assignment) ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) ActualParameterList(org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)

Example 9 with ParameterisedSubReference

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

the class Referenced_Template method checkRecursions.

@Override
public /**
 * {@inheritDoc}
 */
void checkRecursions(final CompilationTimeStamp timestamp, final IReferenceChain referenceChain) {
    if (referenceChain.add(this) && reference != null) {
        final ISubReference subReference = reference.getSubreferences().get(0);
        if (subReference instanceof ParameterisedSubReference) {
            final ActualParameterList parameterList = ((ParameterisedSubReference) subReference).getActualParameters();
            if (parameterList != null) {
                parameterList.checkRecursions(timestamp, referenceChain);
            }
        }
        final IReferenceChain tempReferenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
        final ITTCN3Template template = getTemplateReferenced(timestamp, tempReferenceChain);
        tempReferenceChain.release();
        if (template != null && !template.getIsErroneous(timestamp) && !this.equals(template)) {
            template.checkRecursions(timestamp, referenceChain);
        }
    }
}
Also used : ISubReference(org.eclipse.titan.designer.AST.ISubReference) ParameterisedSubReference(org.eclipse.titan.designer.AST.ParameterisedSubReference) IReferenceChain(org.eclipse.titan.designer.AST.IReferenceChain) ActualParameterList(org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)

Aggregations

ISubReference (org.eclipse.titan.designer.AST.ISubReference)9 ParameterisedSubReference (org.eclipse.titan.designer.AST.ParameterisedSubReference)9 Assignment (org.eclipse.titan.designer.AST.Assignment)7 ActualParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameterList)6 Reference (org.eclipse.titan.designer.AST.Reference)4 IValue (org.eclipse.titan.designer.AST.IValue)3 ExpressionStruct (org.eclipse.titan.designer.AST.TTCN3.values.expressions.ExpressionStruct)3 IReferenceChain (org.eclipse.titan.designer.AST.IReferenceChain)2 Def_Template (org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Template)2 FormalParameterList (org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameterList)2 AltGuard.altguard_type (org.eclipse.titan.designer.AST.TTCN3.statements.AltGuard.altguard_type)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 ArraySubReference (org.eclipse.titan.designer.AST.ArraySubReference)1 FieldSubReference (org.eclipse.titan.designer.AST.FieldSubReference)1 Identifier (org.eclipse.titan.designer.AST.Identifier)1 ActualParameter (org.eclipse.titan.designer.AST.TTCN3.definitions.ActualParameter)1 Referenced_ActualParameter (org.eclipse.titan.designer.AST.TTCN3.definitions.Referenced_ActualParameter)1 Template_ActualParameter (org.eclipse.titan.designer.AST.TTCN3.definitions.Template_ActualParameter)1 Integer_Value (org.eclipse.titan.designer.AST.TTCN3.values.Integer_Value)1