[JS IR] assert there are no clashing declarations

This commit is contained in:
Anton Bannykh
2021-12-06 11:13:27 +03:00
parent 175d722097
commit 9b47a321d5
@@ -115,7 +115,20 @@ class Merger(
return rootNode
}
private fun assertSingleDefinition() {
val definitions = mutableSetOf<String>()
fragments.forEach {
it.definitions.forEach {
if (!definitions.add(it)) {
error("Clashing definitions with tag '$it'")
}
}
}
}
fun merge(): JsProgram {
assertSingleDefinition()
linkJsNames()
val moduleBody = mutableListOf<JsStatement>().also {