use of org.eclipse.titan.designer.AST.TTCN3.types.subtypes.SubType in project titan.EclipsePlug-ins by eclipse.
the class UniversalCharstring_Type method checkCodingAttributes.
@Override
public /**
* {@inheritDoc}
*/
void checkCodingAttributes(final CompilationTimeStamp timestamp, final IReferenceChain refChain) {
// check raw attributes
if (subType != null) {
final int restrictionLength = subType.get_length_restriction();
if (restrictionLength != -1) {
if (rawAttribute == null) {
rawAttribute = new RawAST(getDefaultRawFieldLength());
}
if (rawAttribute.fieldlength == 0) {
rawAttribute.fieldlength = restrictionLength * 8;
rawAttribute.length_restriction = -1;
} else {
rawAttribute.length_restriction = restrictionLength;
}
}
}
// TODO add checks for other encodings.
}
use of org.eclipse.titan.designer.AST.TTCN3.types.subtypes.SubType in project titan.EclipsePlug-ins by eclipse.
the class UniversalCharstring_Type method generateCode.
@Override
public /**
* {@inheritDoc}
*/
void generateCode(final JavaGenData aData, final StringBuilder source) {
generateCodeTypedescriptor(aData, source);
if (needsAlias()) {
final String ownName = getGenNameOwn();
source.append(MessageFormat.format("\tpublic static class {0} extends {1} '{' '}'\n", ownName, getGenNameValue(aData, source, myScope)));
source.append(MessageFormat.format("\tpublic static class {0}_template extends {1} '{' '}'\n", ownName, getGenNameTemplate(aData, source, myScope)));
}
if (hasDoneAttribute()) {
generateCodeDone(aData, source);
}
if (subType != null) {
subType.generateCode(aData, source);
}
generateCodeForCodingHandlers(aData, source);
}
use of org.eclipse.titan.designer.AST.TTCN3.types.subtypes.SubType 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);
}
use of org.eclipse.titan.designer.AST.TTCN3.types.subtypes.SubType in project titan.EclipsePlug-ins by eclipse.
the class Integer_Type method checkThisValueLimit.
/**
* Checks if a given value is a valid integer limit.
* <p>
* The special float values infinity and -infinity are valid integer range limits too.
*
* @param timestamp the time stamp of the actual semantic check cycle.
* @param value the value to be checked
* @param expectedValue the kind of the value to be expected
* @param incompleteAllowed true if an incomplete value can be accepted at the given location, false otherwise
* @param omitAllowed true if the omit value can be accepted at the given location, false otherwise
* @param subCheck true if the subtypes should also be checked.
* @param implicitOmit true if the implicit omit optional attribute was set for the value, false otherwise
*/
public void checkThisValueLimit(final CompilationTimeStamp timestamp, final IValue value, final Expected_Value_type expectedValue, final boolean incompleteAllowed, final boolean omitAllowed, final boolean subCheck, final boolean implicitOmit) {
super.checkThisValue(timestamp, value, null, new ValueCheckingOptions(expectedValue, incompleteAllowed, omitAllowed, subCheck, implicitOmit, false));
final IValue last = value.getValueRefdLast(timestamp, expectedValue, null);
if (last == null || last.getIsErroneous(timestamp)) {
return;
}
// already handled ones
switch(value.getValuetype()) {
case OMIT_VALUE:
case REFERENCED_VALUE:
return;
case UNDEFINED_LOWERIDENTIFIER_VALUE:
if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
return;
}
break;
default:
break;
}
switch(last.getValuetype()) {
case INTEGER_VALUE:
break;
case REAL_VALUE:
{
final Real_Value real = (Real_Value) last;
if (!real.isNegativeInfinity() && !real.isPositiveInfinity()) {
value.getLocation().reportSemanticError(INTEGERVALUEEXPECTED);
value.setIsErroneous(true);
}
break;
}
case EXPRESSION_VALUE:
case MACRO_VALUE:
// already checked
break;
default:
value.getLocation().reportSemanticError(INTEGERVALUEEXPECTED);
value.setIsErroneous(true);
}
if (subCheck) {
// there is no parent type to check
if (subType != null) {
subType.checkThisValue(timestamp, last);
}
}
}
Aggregations