use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase in project titan.EclipsePlug-ins by eclipse.
the class Testcase_Type method checkThisValue.
@Override
public /**
* {@inheritDoc}
*/
boolean checkThisValue(final CompilationTimeStamp timestamp, final IValue value, final Assignment lhs, final ValueCheckingOptions valueCheckingOptions) {
final boolean selfReference = super.checkThisValue(timestamp, value, lhs, valueCheckingOptions);
final IValue last = value.getValueRefdLast(timestamp, valueCheckingOptions.expected_value, null);
if (last == null || last.getIsErroneous(timestamp)) {
return selfReference;
}
last.setMyGovernor(this);
// already handled ones
switch(value.getValuetype()) {
case OMIT_VALUE:
case REFERENCED_VALUE:
return selfReference;
case UNDEFINED_LOWERIDENTIFIER_VALUE:
if (Value_type.REFERENCED_VALUE.equals(last.getValuetype())) {
return selfReference;
}
break;
default:
break;
}
Def_Testcase testcase = null;
switch(last.getValuetype()) {
case TESTCASE_REFERENCE_VALUE:
testcase = ((Testcase_Reference_Value) last).getReferredTestcase();
if (testcase == null) {
setIsErroneous(true);
return selfReference;
}
testcase.check(timestamp);
break;
case TTCN3_NULL_VALUE:
value.setValuetype(timestamp, Value_type.FAT_NULL_VALUE);
return selfReference;
case EXPRESSION_VALUE:
case MACRO_VALUE:
// already checked
return selfReference;
default:
value.getLocation().reportSemanticError(TESTCASEREFERENCEVALUEEXPECTED);
value.setIsErroneous(true);
return selfReference;
}
final Component_Type temporalRunsOnType = testcase.getRunsOnType(timestamp);
if (temporalRunsOnType != null) {
if (runsOnType != null && !temporalRunsOnType.isCompatible(timestamp, runsOnType, null, null, null)) {
value.getLocation().reportSemanticError(MessageFormat.format(INCOMPATIBLERUNSONTYPESERROR, getTypename(), runsOnType.getTypename(), testcase.getAssignmentName(), temporalRunsOnType.getTypename()));
value.setIsErroneous(true);
}
}
formalParList.checkCompatibility(timestamp, testcase.getFormalParameterList(), value.getLocation());
Component_Type temporalSystemType = testcase.getSystemType(timestamp);
if (temporalSystemType == null) {
temporalSystemType = temporalRunsOnType;
}
if (systemRef == null) {
if (temporalSystemType != null && runsOnType != null && !temporalSystemType.isCompatible(timestamp, runsOnType, null, null, null)) {
value.getLocation().reportSemanticError(MessageFormat.format(SYSTEMCLAUSEMISMATCHERROR, getTypename(), runsOnType.getTypename(), testcase.getAssignmentName(), temporalSystemType.getTypename()));
value.setIsErroneous(true);
}
} else {
if (temporalSystemType != null && systemType != null && !temporalSystemType.isCompatible(timestamp, systemType, null, null, null)) {
value.getLocation().reportSemanticError(MessageFormat.format(SYSTEMCLAUSEMISMATCHERROR, getTypename(), systemType.getTypename(), testcase.getAssignmentName(), temporalSystemType.getTypename()));
value.setIsErroneous(true);
}
}
if (valueCheckingOptions.sub_check) {
// there is no parent type to check
if (subType != null) {
subType.checkThisValue(timestamp, value);
}
}
value.setLastTimeChecked(timestamp);
return selfReference;
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase in project titan.EclipsePlug-ins by eclipse.
the class ModuleStatNode method getChildren.
@Override
public Object[] getChildren(final MetricData data) {
if (initialized) {
return children;
}
final List<? super IContentNode> c = new ArrayList<IContentNode>();
if (metric instanceof FunctionMetric) {
for (final Def_Function f : data.getFunctions().get(module)) {
c.add(new FunctionNode((FunctionMetric) metric, f));
}
} else if (metric instanceof TestcaseMetric) {
for (final Def_Testcase t : data.getTestcases().get(module)) {
c.add(new TestcaseNode((TestcaseMetric) metric, t));
}
} else if (metric instanceof AltstepMetric) {
for (final Def_Altstep a : data.getAltsteps().get(module)) {
c.add(new AltstepNode((AltstepMetric) metric, a));
}
} else {
throw new AssertionError("ModuleStatNode should have a subModule-metric");
}
children = c.toArray();
initialized = true;
return children;
}
use of org.eclipse.titan.designer.AST.TTCN3.definitions.Def_Testcase in project titan.EclipsePlug-ins by eclipse.
the class TMLinesOfCode method measure.
@Override
public Number measure(final MetricData data, final Def_Testcase testcase) {
final Counter count = new Counter(0);
testcase.accept(new CounterVisitor(count) {
@Override
public int visit(final IVisitableNode node) {
if (node instanceof Def_Testcase) {
return V_CONTINUE;
}
if (node instanceof StatementBlock) {
count.set(((LargeLocation) ((StatementBlock) node).getLocation()).getEndLine());
}
return V_SKIP;
}
});
return count.val() - testcase.getLocation().getLine() + 1;
}
Aggregations