use of org.eclipse.titan.designer.AST.IType in project titan.EclipsePlug-ins by eclipse.
the class Def_ModulePar 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(PORTNOTALLOWED, lastType.getFullName()));
break;
case TYPE_SIGNATURE:
location.reportSemanticError(MessageFormat.format(SIGNATURENOTALLOWED, lastType.getFullName()));
break;
case TYPE_FUNCTION:
case TYPE_ALTSTEP:
case TYPE_TESTCASE:
if (((Function_Type) lastType).isRunsOnSelf()) {
location.reportSemanticError(MessageFormat.format(RUNSONSELF_NOT_ALLOWED, lastType.getFullName()));
}
break;
default:
break;
}
if (defaultValue != null) {
defaultValue.setMyGovernor(type);
final IValue temporalValue = type.checkThisValueRef(timestamp, defaultValue);
type.checkThisValue(timestamp, temporalValue, null, new ValueCheckingOptions(Expected_Value_type.EXPECTED_CONSTANT, true, false, true, hasImplicitOmitAttribute(timestamp), false));
defaultValue.setCodeSection(CodeSectionType.CS_PRE_INIT);
}
}
use of org.eclipse.titan.designer.AST.IType 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.IType in project titan.EclipsePlug-ins by eclipse.
the class Def_Testcase method getOutlineText.
@Override
public /**
* {@inheritDoc}
*/
String getOutlineText() {
if (lastTimeChecked == null) {
check(CompilationTimeStamp.getBaseTimestamp());
}
final StringBuilder text = new StringBuilder(identifier.getDisplayName());
if (formalParList == null) {
return text.toString();
}
text.append('(');
for (int i = 0; i < formalParList.getNofParameters(); i++) {
if (i != 0) {
text.append(", ");
}
final FormalParameter parameter = formalParList.getParameterByIndex(i);
if (Assignment_type.A_PAR_TIMER.semanticallyEquals(parameter.getRealAssignmentType())) {
text.append("timer");
} else {
final IType type = parameter.getType(lastTimeChecked);
if (type == null) {
text.append("Unknown type");
} else {
text.append(type.getTypename());
}
}
}
text.append(')');
return text.toString();
}
use of org.eclipse.titan.designer.AST.IType in project titan.EclipsePlug-ins by eclipse.
the class Def_Var method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
isUsed = false;
wasAssigned = false;
if (getMyScope() instanceof ComponentTypeBody) {
NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_COMPONENT_VARIABLE, identifier, this);
} else {
NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_LOCAL_VARIABLE, identifier, this);
}
NamingConventionHelper.checkNameContents(identifier, getMyScope().getModuleScope().getIdentifier(), getDescription());
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(PORTNOTALLOWED, lastType.getFullName()));
break;
case TYPE_SIGNATURE:
location.reportSemanticError(MessageFormat.format(SIGNATURENOTALLOWED, lastType.getFullName()));
break;
default:
break;
}
if (initialValue != null) {
initialValue.setMyGovernor(type);
final IValue temporalValue = type.checkThisValueRef(timestamp, initialValue);
if (isLocal()) {
type.checkThisValue(timestamp, temporalValue, this, new ValueCheckingOptions(Expected_Value_type.EXPECTED_DYNAMIC_VALUE, true, false, true, false, false));
} else {
type.checkThisValue(timestamp, temporalValue, this, new ValueCheckingOptions(Expected_Value_type.EXPECTED_STATIC_VALUE, true, false, true, false, false));
}
initialValue.setGenNameRecursive(getGenName());
initialValue.setCodeSection(CodeSectionType.CS_INLINE);
}
}
use of org.eclipse.titan.designer.AST.IType in project titan.EclipsePlug-ins by eclipse.
the class Def_Var_Template method check.
@Override
public /**
* {@inheritDoc}
*/
void check(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) {
return;
}
lastTimeChecked = timestamp;
isUsed = false;
wasAssigned = false;
NamingConventionHelper.checkConvention(PreferenceConstants.REPORTNAMINGCONVENTION_LOCAL_VARTEMPLATE, identifier, this);
NamingConventionHelper.checkNameContents(identifier, getMyScope().getModuleScope().getIdentifier(), getDescription());
if (type == null) {
lastTimeChecked = timestamp;
return;
}
type.setGenName("_T_", getGenName());
type.check(timestamp);
if (initialValue == null) {
return;
}
final IType lastType = type.getTypeRefdLast(timestamp);
switch(lastType.getTypetype()) {
case TYPE_PORT:
location.reportSemanticError(MessageFormat.format(PORTNOTALLOWED, lastType.getFullName()));
break;
default:
break;
}
TTCN3Template realInitialValue = initialValue;
initialValue.setMyGovernor(type);
// Needed in case of universal charstring templates
if (initialValue.getTemplatetype() == Template_type.CSTR_PATTERN && lastType.getTypetype() == Type.Type_type.TYPE_UCHARSTRING) {
realInitialValue = initialValue.setTemplatetype(timestamp, Template_type.USTR_PATTERN);
// FIXME implement setting the pattern type, once
// universal charstring pattern are supported.
}
final ITTCN3Template temporalValue = type.checkThisTemplateRef(timestamp, realInitialValue);
temporalValue.checkThisTemplateGeneric(timestamp, type, true, true, true, true, false, this);
generateRestrictionCheck = TemplateRestriction.check(timestamp, this, realInitialValue, null);
realInitialValue.setCodeSection(CodeSectionType.CS_INLINE);
// here
if (withAttributesPath != null) {
withAttributesPath.checkGlobalAttributes(timestamp, false);
withAttributesPath.checkAttributes(timestamp);
}
if (mFormalParList != null) {
mFormalParList.reset();
mFormalParList.check(timestamp, getAssignmentType());
// template variable is always local
location.reportSemanticError(MessageFormat.format(PARAMETRIZED_LOCAL_TEMPLATE_VAR, getIdentifier()));
}
initialValue.setGenNameRecursive(getGenName());
initialValue.setCodeSection(CodeSectionType.CS_INLINE);
}
Aggregations