diff --git a/plugins/package-managers/bower/src/main/kotlin/Bower.kt b/plugins/package-managers/bower/src/main/kotlin/Bower.kt index d7d5b1992054..32c549d1f117 100644 --- a/plugins/package-managers/bower/src/main/kotlin/Bower.kt +++ b/plugins/package-managers/bower/src/main/kotlin/Bower.kt @@ -175,10 +175,8 @@ private fun parseDependencyTree( info: PackageInfo, scopeName: String, packageInfoForName: Map -): Set { - val result = mutableSetOf() - - info.getScopeDependencies(scopeName).forEach { name -> +): Set = + info.getScopeDependencies(scopeName).mapTo(mutableSetOf()) { name -> // Bower leaves out a dependency entry for a child if there exists a similar entry to its parent entry // with the exact same name and resolved target. This makes it necessary to retrieve the information // about the subtree rooted at the parent from that other entry containing the full dependency @@ -187,12 +185,9 @@ private fun parseDependencyTree( val childInfo = info.dependencies[name] ?: packageInfoForName.getValue(name) val childScope = SCOPE_NAME_DEPENDENCIES val childDependencies = parseDependencyTree(childInfo, childScope, packageInfoForName) - val packageReference = PackageReference( + + PackageReference( id = childInfo.toId(), dependencies = childDependencies ) - result += packageReference } - - return result -}