use of abs.frontend.ast.ExpFunctionDef in project abstools by abstools.
the class TreeUtilsTest method findChildrenIncludeSelf.
@Test
public void findChildrenIncludeSelf() {
Model model = assertParseOkStdLib("def Int test(Int i) = test(1);");
FunctionDecl functionDecl = getLastFunctionDecl(model);
assertEquals("test", functionDecl.getName());
ExpFunctionDef def = (ExpFunctionDef) functionDecl.getFunctionDef();
PureExp exp = def.getRhs();
Stream<PureExp> children = def.findChildren(cast(PureExp.class), n -> true);
assertNotNull(children);
List<PureExp> result = children.distinct().collect(Collectors.toList());
assertEquals(2, result.size());
assertTrue(result.contains(exp));
}
Aggregations