use of org.eclipse.titan.designer.AST.TTCN3.statements.AltGuard in project titan.EclipsePlug-ins by eclipse.
the class IfInsteadAltguard method process.
@Override
public void process(final IVisitableNode node, final Problems problems) {
if (node instanceof AltGuard) {
final AltGuard ag = (AltGuard) node;
final StatementBlock statements = ag.getStatementBlock();
if (statements != null && !statements.isEmpty()) {
final Statement firstStatement = statements.getStatementByIndex(0);
if (firstStatement instanceof If_Statement) {
final Value condition = ((If_Statement) firstStatement).getIfClauses().getClauses().get(0).getExpression();
Location reportAt;
if (condition != null) {
reportAt = condition.getLocation();
} else {
reportAt = firstStatement.getLocation();
}
problems.report(reportAt, MIGHT_ALTGUARD);
}
}
}
}
use of org.eclipse.titan.designer.AST.TTCN3.statements.AltGuard in project titan.EclipsePlug-ins by eclipse.
the class Def_Altstep method setMyScope.
@Override
public /**
* {@inheritDoc}
*/
void setMyScope(final Scope scope) {
if (bridgeScope != null && bridgeScope.getParentScope() == scope) {
return;
}
bridgeScope = new NamedBridgeScope();
bridgeScope.setParentScope(scope);
scope.addSubScope(getLocation(), bridgeScope);
bridgeScope.setScopeMacroName(identifier.getDisplayName());
super.setMyScope(bridgeScope);
if (runsOnRef != null) {
runsOnRef.setMyScope(bridgeScope);
}
formalParList.setMyScope(bridgeScope);
if (block != null) {
block.setMyScope(formalParList);
altGuards.setMyScope(block);
bridgeScope.addSubScope(block.getLocation(), block);
}
bridgeScope.addSubScope(formalParList.getLocation(), formalParList);
if (altGuards != null) {
for (int i = 0; i < altGuards.getNofAltguards(); i++) {
final AltGuard ag = altGuards.getAltguardByIndex(i);
final StatementBlock sb = ag.getStatementBlock();
if (sb != null) {
bridgeScope.addSubScope(sb.getLocation(), sb);
}
}
}
}
Aggregations