use of org.abs_models.frontend.ast.PureExp in project abstools by abstools.
the class SchedulerChecker method checkClassDecl.
@Override
public void checkClassDecl(ClassDecl decl) {
PureExp sched = AnnotationHelper.getAnnotationValueFromName(decl.getAnnotations(), "ABS.Scheduler.Scheduler");
checkScheduleExp(sched, decl, decl);
}
use of org.abs_models.frontend.ast.PureExp in project abstools by abstools.
the class TreeUtilsTest method recurseForSome.
@Test
public void recurseForSome() {
Model model = assertParse("def Int test(Int i) = 1 + test(2);");
FunctionDecl functionDecl = getLastFunctionDecl(model);
assertEquals("test", functionDecl.getName());
FunctionDef def = functionDecl.getFunctionDef();
Stream<PureExp> children = def.findChildren(cast(PureExp.class), AddExp.class::isInstance);
assertNotNull(children);
List<PureExp> result = children.distinct().collect(Collectors.toList());
// expecting AddExp, IntLiteral(1), FnApp, NOT IntLiteral(2)
assertEquals(3, result.size());
for (PureExp exp : result) {
assertFalse(exp instanceof IntLiteral && ((IntLiteral) exp).getContent().equals("2"));
}
}
Aggregations