Skip to content

Commit

Permalink
🦄 refactor: Revise find()
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Nov 20, 2024
1 parent 91f5dae commit eef6998
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@ default <T extends ISwc4jAst> List<T> find(Class<T> clazz) {
* @return the list of AST nodes
* @since 1.3.0
*/
@SuppressWarnings("unchecked")
default <T extends ISwc4jAst> List<T> find(Class<T> clazz, int depth) {
AssertionUtils.notNull(clazz, "Class");
List<T> nodes = SimpleList.of();
getChildNodes().forEach((childNode) -> {
if (clazz.isAssignableFrom(childNode.getClass())) {
nodes.add((T) childNode);
nodes.add(childNode.as(clazz));
}
if (depth != 0) {
final int newDepth = depth > 0 ? depth - 1 : depth;
Expand Down

0 comments on commit eef6998

Please sign in to comment.