use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class TTCN3_Null_Value method checkEquality.
@Override
public /**
* {@inheritDoc}
*/
boolean checkEquality(final CompilationTimeStamp timestamp, final IValue other) {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = other.getValueRefdLast(timestamp, referenceChain);
referenceChain.release();
return getValuetype().equals(last.getValuetype());
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Testcase_Reference_Value method checkEquality.
@Override
public /**
* {@inheritDoc}
*/
boolean checkEquality(final CompilationTimeStamp timestamp, final IValue other) {
final IReferenceChain referenceChain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = other.getValueRefdLast(timestamp, referenceChain);
referenceChain.release();
return Value_type.TESTCASE_REFERENCE_VALUE.equals(last.getValuetype()) && referredTestcase == ((Testcase_Reference_Value) last).getReferredTestcase();
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class ActivateDereferedExpression method generateCodeExpressionExpression.
@Override
public /**
* {@inheritDoc}
*/
void generateCodeExpressionExpression(final JavaGenData aData, final ExpressionStruct expression) {
final IReferenceChain chain = ReferenceChain.getInstance(IReferenceChain.CIRCULARREFERENCE, true);
final IValue last = value.getValueRefdLast(CompilationTimeStamp.getBaseTimestamp(), chain);
chain.release();
if (last.getValuetype() == Value_type.ALTSTEP_REFERENCE_VALUE) {
// the referred testcase is known
final Def_Testcase testcase = ((Testcase_Reference_Value) last).getReferredTestcase();
expression.expression.append(MessageFormat.format("{0}(", testcase.getGenNameFromScope(aData, expression.expression, myScope, "activate_")));
} else {
// the referred testcase is unknown
value.generateCodeExpressionMandatory(aData, expression, true);
expression.expression.append(".activate(");
}
actualParameters.generateCodeAlias(aData, expression);
expression.expression.append(')');
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Def_ModulePar_Template method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
T3Doc.check(this.getCommentLocation(), KIND);
isUsed = false;
NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_MODULEPAR, identifier, this);
NamingConventionHelper.checkNameContents(identifier, getMyScope().getModuleScope().getIdentifier(), getDescription());
if (withAttributesPath != null) {
withAttributesPath.checkGlobalAttributes(timestamp, false);
withAttributesPath.checkAttributes(timestamp);
}
if (type == null) {
return;
}
type.setGenName("_T_", getGenName());
type.check(timestamp);
final IType lastType = type.getTypeRefdLast(timestamp);
switch(lastType.getTypetype()) {
case TYPE_PORT:
location.reportSemanticError(MessageFormat.format(Def_ModulePar.PORTNOTALLOWED, lastType.getFullName()));
break;
case TYPE_SIGNATURE:
location.reportSemanticError(MessageFormat.format(Def_ModulePar.SIGNATURENOTALLOWED, lastType.getFullName()));
break;
case TYPE_FUNCTION:
case TYPE_ALTSTEP:
case TYPE_TESTCASE:
if (((Function_Type) lastType).isRunsOnSelf()) {
location.reportSemanticError(MessageFormat.format(Def_ModulePar.RUNSONSELF_NOT_ALLOWED, lastType.getFullName()));
}
break;
default:
break;
}
if (defaultTemplate != null) {
realTemplate = defaultTemplate;
// Needed in case of universal charstring templates
if (defaultTemplate.getTemplatetype() == Template_type.CSTR_PATTERN && lastType.getTypetype() == Type.Type_type.TYPE_UCHARSTRING) {
realTemplate = defaultTemplate.setTemplatetype(timestamp, Template_type.USTR_PATTERN);
// FIXME implement setting the pattern type,
// once universal charstring pattern are
// supported.
}
final ITTCN3Template temporalTemplate = type.checkThisTemplateRef(timestamp, realTemplate);
temporalTemplate.checkThisTemplateGeneric(timestamp, type, false, true, true, true, false, null);
final IReferenceChain tempReferenceChain = ReferenceChain.getInstance(Def_Template.CIRCULAREMBEDDEDRECURSION, true);
tempReferenceChain.add(this);
temporalTemplate.checkRecursions(timestamp, tempReferenceChain);
tempReferenceChain.release();
// defaultTemplate.setGenNamePrefix("modulepar_");//currently does not need the prefix
defaultTemplate.setGenNameRecursive(getGenName());
defaultTemplate.setCodeSection(CodeSectionType.CS_PRE_INIT);
}
}
use of org.eclipse.titan.designer.AST.IReferenceChain in project titan.EclipsePlug-ins by eclipse.
the class Def_Template method checkRecursiveDerivation.
/**
* Checks if the derivation chain of the templates is recursive or not.
*
* @param timestamp
* the timestamp of the actual semantic check cycle
*/
private void checkRecursiveDerivation(final CompilationTimeStamp timestamp) {
if (recursiveDerivationChecked != null && !recursiveDerivationChecked.isLess(timestamp)) {
return;
}
if (baseTemplate != null) {
final IReferenceChain tempReferenceChain = ReferenceChain.getInstance(CIRCULARBASETEMPLATES, true);
tempReferenceChain.add(this);
Def_Template iterator = baseTemplate;
while (iterator != null) {
if (iterator.recursiveDerivationChecked != null && !iterator.recursiveDerivationChecked.isLess(timestamp)) {
break;
}
if (tempReferenceChain.add(iterator)) {
iterator.recursiveDerivationChecked = timestamp;
} else {
break;
}
iterator = iterator.baseTemplate;
}
tempReferenceChain.release();
}
recursiveDerivationChecked = timestamp;
}
Aggregations