use of org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance in project titan.EclipsePlug-ins by eclipse.
the class SuperfluousTemplate method visit.
@Override
public int visit(final IVisitableNode node) {
if (node instanceof TemplateInstance) {
template = (TemplateInstance) node;
final ITTCN3Template body = template.getTemplateBody();
if (body instanceof Any_Value_Template || body instanceof AnyOrOmit_Template) {
final Type type = template.getType();
if (type == null) {
// port.receive(?) or port.receive(*)
receivesAny = true;
} else if (receivableType != null && type.isIdentical(CompilationTimeStamp.getBaseTimestamp(), receivableType)) {
// e.g. port.receive(integer:?)
receivesAllOfType = true;
}
}
// We don't want to investigate nested templates
return V_SKIP;
}
return V_CONTINUE;
}
use of org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance in project titan.EclipsePlug-ins by eclipse.
the class UnnecessaryValueof method process.
@Override
public void process(final IVisitableNode node, final Problems problems) {
if (node instanceof ValueofExpression) {
final ValueofExpression exp = (ValueofExpression) node;
final CompilationTimeStamp stamp = CompilationTimeStamp.getBaseTimestamp();
if (exp.getIsErroneous(stamp) || exp.isUnfoldable(stamp, null)) {
return;
}
final TemplateInstance inst = exp.getTemplateInstance();
if (inst != null && inst.getDerivedReference() == null && inst.getTemplateBody().isValue(stamp)) {
final String msg = MessageFormat.format(TEXT, inst.getTemplateBody().getValue().createStringRepresentation());
problems.report(exp.getLocation(), msg);
}
}
}
use of org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance in project titan.EclipsePlug-ins by eclipse.
the class PortTypeBody method addGetcallProposals.
/**
* Adds the "getcall" related operations of port types, to the completion
* list.
*
* @param propCollector the proposal collector
* @param i index, not used
*/
public static void addGetcallProposals(final ProposalCollector propCollector, final int i) {
propCollector.addProposal("getcall", "getcall", ImageCache.getImage("port.gif"), "");
propCollector.addTemplateProposal("getcall", new Template("getcall from myPartner", "from clause", propCollector.getContextIdentifier(), "getcall from ${myPartner};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("getcall", new Template("getcall -> sender myPartnerVar", "sender redirect", propCollector.getContextIdentifier(), "getcall -> sender ${myPartnerVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("getcall", new Template("getcall( templateInstance )", "", propCollector.getContextIdentifier(), "getcall( ${templateInstance} );", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("getcall", new Template("getcall( templateInstance ) from myPartner", "from clause", propCollector.getContextIdentifier(), "getcall( ${templateInstance} ) from ${myPartner};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("getcall", new Template("getcall( templateInstance ) -> sender myPartnerVar", "sender redirect", propCollector.getContextIdentifier(), "getcall( ${templateInstance} ) -> sender ${myPartnerVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("getcall", new Template("getcall( templateInstance ) -> param(parameters)", "parameters", propCollector.getContextIdentifier(), "getcall( ${templateInstance} ) -> param( ${parameters} );", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("getcall", new Template("getcall( templateInstance ) from myPartner -> param(parameters)", "from clause and parameters", propCollector.getContextIdentifier(), "getcall( ${templateInstance} ) from ${myPartner} -> param( ${parameters} );", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("getcall", new Template("getcall( templateInstance ) -> param(parameters) sender mySenderVar", "parameters and sender clause", propCollector.getContextIdentifier(), "getcall( ${templateInstance} ) -> param( ${parameters} ) sender ${mySenderVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
}
use of org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance in project titan.EclipsePlug-ins by eclipse.
the class PortTypeBody method addReceiveProposals.
/**
* Adds the "receive" related operations of port types, to the completion
* list.
*
* @param propCollector the proposal collector
* @param i index, not used
*/
private static void addReceiveProposals(final ProposalCollector propCollector, final int i) {
propCollector.addProposal("receive", "receive", ImageCache.getImage("port.gif"), "");
propCollector.addTemplateProposal("receive", new Template("receive -> value myVar", "value redirect", propCollector.getContextIdentifier(), "receive -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive -> sender myPeer", "sender redirect", propCollector.getContextIdentifier(), "receive -> sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive -> value myVar sender myPeer", "value and sender redirect", propCollector.getContextIdentifier(), "receive -> value ${myVar} sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive from myPeer", "from clause", propCollector.getContextIdentifier(), "receive from ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive from myPeer -> value myVar", "from clause with value redirect", propCollector.getContextIdentifier(), "receive from ${myPeer} -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive( templateInstance )", "", propCollector.getContextIdentifier(), "receive( ${template} );", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive( templateInstance ) -> value myVar", "value redirect", propCollector.getContextIdentifier(), "receive( ${templateInstance} ) -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive( templateInstance ) -> sender myPeer", "sender redirect", propCollector.getContextIdentifier(), "receive( ${templateInstance} ) -> sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive( templateInstance ) -> value myVar sender myPeer", "value and sender redirect", propCollector.getContextIdentifier(), "receive( ${templateInstance} ) -> value ${myVar} sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive( templateInstance ) from myPeer", "from clause", propCollector.getContextIdentifier(), "receive( ${templateInstance} ) from ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("receive", new Template("receive( templateInstance ) from myPeer -> value myVar", "from clause with value redirect", propCollector.getContextIdentifier(), "receive( ${templateInstance} ) from ${myPeer} -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
}
use of org.eclipse.titan.designer.AST.TTCN3.templates.TemplateInstance in project titan.EclipsePlug-ins by eclipse.
the class PortTypeBody method addCatchProposals.
/**
* Adds the "catch" related operations of port types, to the completion
* list.
*
* @param propCollector the proposal collector
* @param i index, not used
*/
public static void addCatchProposals(final ProposalCollector propCollector, final int i) {
propCollector.addProposal("catch", "catch", ImageCache.getImage("port.gif"), "");
propCollector.addTemplateProposal("catch", new Template("catch -> value myVar", "value redirect", propCollector.getContextIdentifier(), "catch -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch -> sender myPeer", "sender redirect", propCollector.getContextIdentifier(), "catch -> sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch -> value myVar sender myPeer", "value and sender redirect", propCollector.getContextIdentifier(), "catch -> value ${myVar} sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch from myPeer", "from clause", propCollector.getContextIdentifier(), "catch from ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch from myPeer -> value myVar", "from clause with value redirect", propCollector.getContextIdentifier(), "catch from ${myPeer} -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch( signature, templateInstance )", "", propCollector.getContextIdentifier(), "catch( ${signature}, ${templateInstance} );", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch( signature, templateInstance ) -> value myVar", "value redirect", propCollector.getContextIdentifier(), "catch( ${signature}, ${templateInstance} ) -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch( signature, templateInstance ) -> sender myPeer", "sender redirect", propCollector.getContextIdentifier(), "catch( ${signature}, ${templateInstance} ) -> sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch( signature, templateInstance ) -> value myVar sender myPeer", "value and sender redirect", propCollector.getContextIdentifier(), "catch( ${signature}, ${templateInstance} ) -> value ${myVar} sender ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch( signature, templateInstance ) from myPeer", "from clause", propCollector.getContextIdentifier(), "catch( ${signature}, ${templateInstance} ) from ${myPeer};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch( signature, templateInstance ) from myPeer -> value myVar", "from clause with value redirect", propCollector.getContextIdentifier(), "catch( ${signature}, ${templateInstance} ) from ${myPeer} -> value ${myVar};", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
propCollector.addTemplateProposal("catch", new Template("catch( timeout )", "", propCollector.getContextIdentifier(), "catch( timeout );", false), TTCN3CodeSkeletons.SKELETON_IMAGE);
}
Aggregations