use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter in project titan.EclipsePlug-ins by eclipse.
the class Lazy method process.
@Override
protected void process(final IVisitableNode node, final Problems problems) {
// This variable indicates occurrence of Return_Statement.
haveToContinue = true;
// Collect and store FormalParameters.
formalParameterCollector = new RelevantFormalParameterCollector();
node.accept(formalParameterCollector);
// Build structure.
final RelevantNodeBuilder relevantNodeBuilder = new RelevantNodeBuilder(node);
node.accept(relevantNodeBuilder);
// Evaluate tree and return with FormalParameters which have to be evaluated.
final Set<FormalParameter> shouldBeEvaluated = relevantNodeBuilder.collectRelevantReferences();
for (final FormalParameter formalParameter : formalParameterCollector.getItems()) {
final boolean isLazy = formalParameter.getIsLazy();
String message = null;
if (shouldBeEvaluated.contains(formalParameter)) {
if (isLazy) {
message = "not ";
}
} else {
if (!isLazy) {
message = "";
}
}
if (message != null) {
final String msg = MessageFormat.format(ERROR_MESSAGE, formalParameter.getIdentifier().getDisplayName(), message);
problems.report(formalParameter.getLocation(), msg);
}
}
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter in project titan.EclipsePlug-ins by eclipse.
the class ReadOnlyInOutPar method process.
@Override
public void process(final IVisitableNode node, final Problems problems) {
if (node instanceof FormalParameter) {
final FormalParameter s = (FormalParameter) node;
if (s.getMyParameterList().getMyDefinition() instanceof Def_Type) {
return;
}
if (!s.getWritten() && !(s.getMyParameterList().getMyDefinition() instanceof Def_Extfunction)) {
switch(s.getAssignmentType()) {
case A_PAR_VAL_INOUT:
case A_PAR_TEMP_INOUT:
final String msg = MessageFormat.format(READONLY, s.getDescription());
problems.report(s.getLocation(), msg);
break;
default:
break;
}
}
}
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter in project titan.EclipsePlug-ins by eclipse.
the class ReadOnlyOutPar method process.
@Override
public void process(final IVisitableNode node, final Problems problems) {
if (node instanceof FormalParameter) {
final FormalParameter s = (FormalParameter) node;
if (s.getMyParameterList().getMyDefinition() instanceof Def_Type) {
return;
}
if (!s.getWritten() && !(s.getMyParameterList().getMyDefinition() instanceof Def_Extfunction)) {
switch(s.getAssignmentType()) {
case A_PAR_VAL_OUT:
case A_PAR_TEMP_OUT:
final String msg = MessageFormat.format(READONLY, s.getDescription());
problems.report(s.getLocation(), msg);
break;
default:
break;
}
}
}
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter in project titan.EclipsePlug-ins by eclipse.
the class ReadingOutParBeforeWritten method process.
@Override
protected void process(final IVisitableNode node, final Problems problems) {
this.problems = problems;
if (!(node instanceof FormalParameter)) {
return;
}
final FormalParameter fp = (FormalParameter) node;
this.toFind = fp;
final Assignment_type at = fp.getAssignmentType();
if (at != Assignment_type.A_PAR_VAL_OUT && at != Assignment_type.A_PAR_TEMP_OUT) {
return;
}
final Definition d = fp.getMyParameterList().getMyDefinition();
final NewFuncVisitor visitor = new NewFuncVisitor();
// call visitor on function in which the out parameter was found
d.accept(visitor);
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.FormalParameter in project titan.EclipsePlug-ins by eclipse.
the class Altstep_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);
def.returnType = null;
def.type = fatType.ALTSTEP;
def.runsOnSelf = runsOnSelf;
def.isStartable = false;
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);
}
Aggregations